Part Number Hot Search : 
12A12 AS2578BP 06D17 SM5DK5H 0100M LF12CP C123J 00R12K
Product Description
Full Text Search
 

To Download PIC12F752-I-SN Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2011 microchip technology inc. preliminary ds41576b pic12f752/hv752 data sheet 8-pin, flash-based 8-bit cmos microcontrollers *8-bit, 8-pin devices protected by microchip?s low pin count patent: u.s. patent no. 5,847,450. additional u.s. and foreign patents and applications may be issued or pending.
ds41576b-page 2 preliminary ? 2011 microchip technology inc. information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyer?s risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights. trademarks the microchip name and logo, the microchip logo, dspic, k ee l oq , k ee l oq logo, mplab, pic, picmicro, picstart, pic 32 logo, rfpic and uni/o are registered trademarks of microchip technology incorporated in the u.s.a. and other countries. filterlab, hampshire, hi-tech c, linear active thermistor, mxdev, mxlab, seeval and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. analog-for-the-digital age, app lication maestro, chipkit, chipkit logo, codeguard, dspicdem, dspicdem.net, dspicworks, dsspeak, ecan, economonitor, fansense, hi-tide, in-circuit serial programming, icsp, mindi, miwi, mpasm, mplab certified logo, mplib, mplink, mtouch, omniscient code generation, picc, picc-18, picdem, picdem.net, pickit, pictail, real ice, rflab, select mode, total endurance, tsharc, uniwindriver, wiperlock and zena are trademarks of microchip technology incorporated in the u.s.a. and other countries. sqtp is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2011, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. isbn: 978-1-61341-798-0 note the following details of the code protection feature on microchip devices: ? microchip products meet the specification cont ained in their particular microchip data sheet. ? microchip believes that its family of products is one of the mo st secure families of its kind on the market today, when used i n the intended manner and under normal conditions. ? there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip produc ts in a manner outside the operating specifications contained in microchip?s data sheets. most likely, the person doing so is engaged in theft of intellectual property. ? microchip is willing to work with the customer who is concerned about the integrity of their code. ? neither microchip nor any other semiconductor manufacturer c an guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ?unbreakable.? code protection is constantly evolving. we at microchip are co mmitted to continuously improvi ng the code protection features of our products. attempts to break microchip?s c ode protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona; gresham, oregon and design centers in california and india. the company?s quality system processes and procedures are for its pic ? mcus and dspic ? dscs, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory and analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified.
? 2011 microchip technology inc. preliminary ds41576b-page 3 pic12f752/hv752 high-performance risc cpu: ? only 35 instructions to learn: - all single-cycle instructions except branches ? operating speed: - dc ? 20 mhz clock input - dc ? 200 ns instruction cycle ? 1024 x 14 on-chip flash program memory ? self read/write program memory ? 64 x 8 general purpose registers (sram) ? interrupt capability ? 8-level deep hardware stack ? direct, indirect and relative addressing modes microcontroller features: ? precision internal oscillator: - factory calibrated to 1%, typical - software selectable frequency: 8 mhz, 4 mhz, 1 mhz or 31 khz - software tunable ? power-saving sleep mode ? voltage range (pic12f752): - 2.0v to 5.5v ? shunt voltage regulator (pic12hv752) - 2.0v to user defined - 5 volt regulation - 4 ma to 50 ma shunt range ? multiplexed master clear with pull-up/input pin ? interrupt-on-change pins ? individually programmable weak pull-ups ? power-on reset (por) ? power-up timer (pwrt) ? brown-out reset (bor) ? watchdog timer (wdt) with internal oscillator for reliable operation ? industrial and extended temperature range ? high endurance flash: - 100,000 write flash endurance - flash retention: >40 years ? programmable code protection ? in-circuit debug (icd) via two pins ? in-circuit serial programming? (icsp?) via two pins low-power features: ? standby current: - 50 na @ 2.0v, typical ? operating current: - 11 ua @ 32 khz, 2.0v, typical - 260 ua @ 4 mhz, 2.0v, typical ? watchdog timer current: ? <1 ua @ 2.0v, typical peripheral features: ? 5 i/o pins and 1 input-only pin ? high current source/sink: - 50 ma i/o, (2 pins) - 25 ma i/o, (4 pins) ? 2 high-speed analog comparator modules: - 20 ns response time - fixed voltage reference (fvr) - programmable on-chip voltage reference via integrated 5-bit dac - internal/external inputs and outputs (select- able) - built-in hysteresis (software selectable) ? a/d converter: - 10-bit resolution - 4 external channels - 2 internal reference voltage channels ? dual range digital-to-analog converter (dac): - 5-bit resolution - full range or limited range output - 4 mv steps @ 2.0v (limited range) - 65 mv steps @ 2.0v (full range) ? fixed voltage reference (fvr), 1.2v reference ? capture, compare, pwm (ccp) module: - 16-bit capture, max. resolution = 12.5 ns - compare, max. resolution = 200 ns - 10-bit pwm, max. frequency = 20 khz ? timer0: 8-bit timer/counter with 8-bit prescaler ? enhanced timer1: - 16-bit timer/counter with prescaler - external timer1 gate (count enable) - 4 selectable clock sources ? timer2: 8-bit timer/counter with prescaler - 8-bit period register and postscaler ? hardware limit timer (hlt): - 8-bit timer with prescaler - 8-bit period register and postscaler - asynchronous h/w reset sources ? complementary output generator (cog): - complementary waveforms from selectable sources - 2 i/o (50 ma) for direct mosfet drive - rising and/or falling edge dead-band control - phase control, blanking control - auto-shutdown 8-pin flash-based, 8-bit cmos microcontrollers
pic12f752/hv752 ds41576b-page 4 preliminary ? 2011 microchip technology inc. figure 1: 8-pin diagram, pic12f752/hv752 (pdip, soic, dfn) table 1: pic12f752/hv752 feature summary device flash program memory (user) (words) self read/write flash memory sram (bytes) i/os 10-bit a/d (ch) comparators timers 8/16-bit ccp complementary output generator (cog) shunt regulator pic12f752 1024 y 64 6 4 2 3/1 1 y n pic12hv752 1024 y 64 6 4 2 3/1 1 y y 1 2 3 4 5 6 7 8 pic12f752/hv752 v ss ra0/icspdat ra1/icspclk ra2 mclr /v pp /ra3 v dd ra5 ra4 note: see ta bl e 2 for the location of all peripheral functions.
? 2011 microchip technology inc. preliminary ds41576b-page 5 pic12f752/hv752 table 2: pic12f752/hv752 pin summary (pdip, soic, dfn) i/o pin adc comparators timers ccp interrupts pull-up complementary output generator (cog) voltage reference basic ra0 (5) 7 an0 c1in0+ c2in0+ ? ? ioc y cog1out1 (2) dacout refout icspdat ra1 6 an1 c1in0- c2in0- ??iocy ? v ref + icspclk ra2 (5) 5 an2 c1out c2out t0cki ccp1 ioc int y cog1out0 (2) ? ? ra3 (1) 4? ? t1g (3) ? ioc y (4) cog1flt (3) ?mclr /v pp ra4 3 an3 c1in1- t1g (2) ? ioc y cog1flt (2) cog1out1 (3) ? clkout ra5 2 ? c2in1- t1cki ? ioc y cog1out0 (3) ?clkin ? 1 ? ? ? ? ? ? ? ? v dd ?8? ? ? ? ? ? ? ? v ss * alternate pin function. note 1: input only. 2: default pin function via the apfcon register. 3: alternate pin function via the apfcon register. 4: ra3 pull-up is enabled when pin is configured as mclr in configuration word. 5: the port pins for the primary cog1outx pins have high power (hp) output drivers.
pic12f752/hv752 ds41576b-page 6 preliminary ? 2011 microchip technology inc. table of contents 1.0 device overview ............................................................................................................ ............................................................. 9 2.0 memory organization ........................................................................................................ ........................................................ 11 3.0 flash program memory self read/self write control .......................................................................... ..................................... 29 4.0 oscillator module .......................................................................................................... ............................................................. 39 5.0 i/o ports .................................................................................................................. .................................................................. 45 6.0 timer0 module .............................................................................................................. ............................................................ 55 7.0 timer1 module with gate control ............................................................................................ .................................................. 57 8.0 timer2 module .............................................................................................................. ............................................................ 69 9.0 hardware limit timer (hlt) module .......................................................................................... ............................................... 73 10.0 capture/compare/pwm modules ............................................................................................... .............................................. 77 11.0 complementary output generator (cog) module ............................................................................... ..................................... 85 12.0 analog-to-digital converter (adc) module .................................................................................. ........................................... 101 13.0 fixed voltage reference (fvr) ............................................................................................. ................................................. 113 14.0 digital-to-analog converter (dac) module .................................................................................. ........................................... 115 15.0 comparator module ......................................................................................................... ........................................................ 121 16.0 instruction set summary ................................................................................................... ...................................................... 131 17.0 special features of the cpu ............................................................................................... .................................................... 141 18.0 shunt regulator (pic12hv752 only) ......................................................................................... ............................................. 161 19.0 development support ....................................................................................................... ....................................................... 163 20.0 electrical specifications ................................................................................................. .......................................................... 167 21.0 dc and ac characteristics graphs and charts ............................................................................... ....................................... 191 22.0 packaging information ..................................................................................................... ........................................................ 193 index .......................................................................................................................... ....................................................................... 207 the microchip web site ........................................................................................................ ............................................................ 207 customer change notification service .......................................................................................... ................................................... 207 customer support .............................................................................................................. ............................................................... 207 reader response ............................................................................................................... .............................................................. 208 product identification system ................................................................................................. ........................................................... 209
? 2011 microchip technology inc. preliminary ds41576b-page 7 pic12f752/hv752 to our valued customers it is our intention to provide our valued customers with the best documentation possible to ensure successful use of your micro chip products. to this end, we will continue to improve our publications to better suit your needs. our publications will be refined and enhanced as new volumes and updates are introduced. if you have any questions or comments regar ding this publication, please contact the marketing communications department via e-mail at docerrors@microchip.com or fax the reader response form in the back of this data sheet to (480) 792-4150. we welcome your feedback. most current data sheet to obtain the most up-to-date version of this data s heet, please register at our worldwide web site at: http://www.microchip.com you can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page . the last character of the literature number is the vers ion number, (e.g., ds30000a is version a of document ds30000). errata an errata sheet, describing minor operational differences fr om the data sheet and recommended workarounds, may exist for curren t devices. as device/documentation issues become known to us, we will publish an errata sheet. the errata will specify the revisi on of silicon and revision of document to which it applies. to determine if an errata sheet exists for a particular device, please check with one of the following: ? microchip?s worldwide web site; http://www.microchip.com ? your local microchip sales office (see last page) when contacting a sales office, please specify which device, re vision of silicon and data sheet (include literature number) you are using. customer notification system register on our web site at www.microchip.com to receive the most current information on all of our products.
pic12f752/hv752 ds41576b-page 8 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 9 pic12f752/hv752 1.0 device overview the pic12f752/hv752 devices are covered by this data sheet. they are available in 8-pin pdip, soic and dfn packages. block diagrams and pinout descriptions of the devices are in figure 1-1 and table 1-1 . figure 1-1: pic12f75 2/hv752 block diagram flash program memory 13 data bus 8 14 program bus instruction reg program counter ram file registers direct addr 7 ram addr 9 addr mux indirect addr fsr reg status reg mux alu w reg instruction decode & control timing generation clkin clkout porta 8 8 8 3 8-level stack 64 bytes 1k x 14 (13-bit) power-up timer power-on reset watchdog timer mclr v ss brown-out reset timer0 timer1 ra0 ra1 ra2 ra3 ra4 ra5 analog comparator t0cki int t1cki configuration internal oscillator and reference t1g v dd block c1in0+/c2in0+ c1in0-/c2in0- c1in1- c2in1- c1out/c2out shunt regulator (pic12hv752 only) capture/ compare/ pwm (ccp) hardware limit timer1 (hlt) complementary output generator (cog) timer2 fixed voltage reference (fvr) dual range dac
pic12f752/hv752 ds41576b-page 10 preliminary ? 2011 microchip technology inc. table 1-1: pic12f752/hv75 2 pinout description name function input ty pe output type description ra0/cog1out1 (2) /c1in0+/ c2in0+/an0/dacout/ refout/ icspdat ra0 ttl hp general purpose i/o with ioc and wpu. cog1out1 ? hp cog output channel 1. c1in0+ an ? comparator c1 positive input. c2in0+ an ? comparator c2 positive input. an0 an ? a/d channel 0 input. dacout ? an dac unbuffered voltage reference output. refout ? an dac/fvr buffered voltage reference output. icspdat st hp serial programming data i/o. ra1/c1in0-/c2in0-/an1/ v ref +/icspclk ra1 ttl cmos general purpose i/o with ioc and wpu. c1in0- an ? comparator c1 negative input. c2in0- an ? comparator c2 negative input. an1 an ? a/d channel 1 input. v ref + an ? a/d positive voltage reference input. icspclk st ? serial programming clock. ra2/int/ccp1/c2out/ c1out/t0cki/ cog1out0 (2) /an2 ra2 st hp general purpose i/o with ioc and wpu. int st ? external interrupt. ccp1 st hp capture/compare/pwm 1. c2out ? hp comparator c2 output. c1out ? hp comparator c1 output. t0cki st ? timer0 clock input. cog1out0 ? hp cog output channel 0. an2 an ? a/d channel 2 input. ra3 (1) /t1g (3) /cog1flt (3) / v pp /mclr (4) ra3 ttl ? general purpose input with wpu. t1g st ? timer1 gate input. cog1flt st ? cog auto-shutdown fault input. v pp hv ? programming voltage. mclr st ? master clear w/internal pull-up. ra4/t1g (2) /cog1out1 (3) / cog1flt (2) /c1in1-/an3/ clkout ra4 ttl cmos general purpose i/o with ioc and wpu. t1g st ? timer1 gate input. cog1out1 ? cmos cog output channel 1 cog1flt st ? cog auto-shutdown fault input. c1in1- an ? comparator c1 negative input. an3 an ? a/d channel 3 input. clkout ? cmos f osc /4 output. ra5/t1cki/cog1out0 (3) / c2in1-/clkin ra5 ttl cmos general purpose i/o with ioc and wpu. t1cki st ? timer1 clock input. cog1out0 ? cmos cog output channel 0. c2in1- an ? comparator c2 negative input. clkin st ? external clock input (ec mode). v dd v dd power ? positive supply. v ss v ss power ? ground reference. legend: an = analog input or output cmos = cmos compatible input or output ttl = ttl compatible input st = schmitt trigger input with cmos levels hp = high power hv = high voltage * alternate pin function. note 1: input only. 2: default pin function via the apfcon register. 3: alternate pin function via the apfcon register. 4: ra3 pull-up is enabled when pin is configured as mclr in configuration word.
? 2011 microchip technology inc. preliminary ds41576b-page 11 pic12f752/hv752 2.0 memory organization 2.1 program memory organization the pic12f752/hv752 has a 13-bit program counter capable of addressing an 8k x 14 program memory space. only the first 1k x 14 (0000h-03ffh) is physically implemented. accessing a location above these boundaries will cause a wrap-around within the first 1k x 14 space for pic12f752/hv752. the reset vector is at 0000h and the interrupt vector is at 0004h (see figure 2-1 ). figure 2-1: program memory map and stack for the pic12f752/hv752 2.2 data memory organization the data memory (see figure 2-2 ) is partitioned into four banks, which contain the general purpose registers (gpr) and the special function registers (sfr). the special function registers are located in the first 32 locations of each bank. register locations 40h-6fh in bank 0 are general purpose registers, implemented as static ram. register locations 70h-7fh in bank 0 are common ram and shared as the last 16 addresses in all banks. all other ram is unimplemented and returns ? 0 ? when read. the rp<1:0> bits of the status register are the bank select bits. rp1 rp0 00 ? bank 0 is selected 01 ? bank 1 is selected 10 ? bank 2 is selected 11 ? bank 3 is selected pc<12:0> 13 0000h 0004h 0005h 03ffh 0400h 1fffh stack level 1 stack level 8 reset vector interrupt vector on-chip program memory call, return retfie, retlw stack level 2 wraps to 0000h-03ffh
pic12f752/hv752 ds41576b-page 12 preliminary ? 2011 microchip technology inc. 2.2.1 general purpose register file the register file is organized as 64 x 8 in the pic12f752/hv752. each register is accessed, either directly or indirectly, through the file select register (fsr) (see section 2.4 ?indirect addressing, indf and fsr registers? ). 2.2.2 special function registers the special function registers are registers used by the cpu and peripheral functions for controlling the desired operation of the device (see tab l e 2 - 1 ). these registers are static ram. the special registers can be classified into two sets: core and peripheral. the special function registers associated with the ?core? are described in this section. those related to the operation of the peripheral features are described in the section of that peripheral feature.
? 2011 microchip technology inc. preliminary ds41576b-page 13 pic12f752/hv752 figure 2-2: data memory map of the pic12f752/hv752 legend: = unimplemented data memory locations, read as ? 0 ?. bank 0 bank 1 bank 2 bank 3 indf 00h indf 80h indf 100h indf 180h tmr0 01h option_reg 81h tmr0 101h option_reg 181h pcl 02h pcl 82h pcl 102h pcl 182h status 03h status 83h status 103h status 183h fsr 04h fsr 84h fsr 104h fsr 184h porta 05h trisa 85h lata 105h ansela 185h ? 06h ? 86h ? 106h ? 186h ? 07h ? 87h ? 107h ? 187h iocaf 08h iocap 88h iocan 108h apfcon 188h ? 09h ? 89h ? 109h osctune 189h pclath 0ah pclath 8ah pclath 10ah pclath 18ah intcon 0bh intcon 8bh intcon 10bh intcon 18bh pir1 0ch pie1 8ch wpua 10ch pmcon1 18ch pir2 0dh pie2 8dh slrcona 10dh pmcon2 18dh ?0eh ?8eh ? 10eh pmadrl 18eh tmr1l 0fh osccon 8fh pcon 10fh pmadrh 18fh tmr1h 10h fvrcon 90h tmr2 110h pmdatl 190h t1con 11h daccon0 91h pr2 111h pmdath 191h t1gcon 12h daccon1 92h t2con 112h cog1ph 192h ccpr1l 13h ? 93h hltmr1 113h cog1blk 193h ccpr1h 14h ? 94h hltpr1 114h cog1db 194h ccp1con 15h ? 95h hlt1con0 115h cog1con0 195h ? 16h ? 96h hlt1con1 116h cog1con1 196h ? 17h ? 97h ? 117h cog1asd 197h ? 18h ? 98h ? 118h ? 198h ? 19h ? 99h ? 119h ? 199h ?1ah ?9ah ?11ah ? 19ah ? 1bh cm2con0 9bh ?11bh ? 19bh adresl 1ch cm2con1 9ch ?11ch ? 19ch adresh 1dh cm1con0 9dh ?11dh ? 19dh adcon0 1eh cm1con1 9eh ?11eh ? 19eh adcon1 1fh cmout 9fh ?11fh ? 19fh unimplemented 20h 3fh unimplemented a0h efh unimplemented 120h 16fh unimplemented 1a0h 1efh general purpose register 48 bytes 40h 6fh common ram 16 bytes 70h 7fh common ram (accesses 70h-7fh) f0h ffh common ram (accesses 70h-7fh) 170h 17fh common ram (accesses 70h-7fh) 1f0h 1ffh
pic12f752/hv752 ds41576b-page 14 preliminary ? 2011 microchip technology inc. table 2-1: pic12f752/hv752 special registers summary bank 0 adr name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por/bor reset value on all other resets (1) bank 0 00h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx xxxx xxxx 01h tmr0 holding register for the 8-bit tmr0 xxxx xxxx uuuu uuuu 02h pcl program counter's (pc) least significant byte 0000 0000 0000 0000 03h status irp rp1 rp0 to pd zdcc 0001 1xxx 000q quuu 04h fsr indirect data memory address pointer xxxx xxxx uuuu uuuu 05h porta ? ? ra5 ra4 ra3 ra2 ra1 ra0 --xx xxxx --uu uuuu 06h ? unimplemented ? ? 07h ? unimplemented ? ? 08h iocaf ? ? iocaf5 iocaf4 iocaf3 iocaf2 iocaf1 iocaf0 --00 0000 --00 0000 09h ? unimplemented ? ? 0ah pclath ? ? ? write buffer for upper 5 bits of program counter ---0 0000 ---0 0000 0bh intcon gie peie t0ie inte iocie t0if intf iocif (2) 0000 0000 0000 0000 0ch pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 00---000 00---000 0dh pir2 ? ? c2if c1if ? cog1if ? ccp1if --00 -0-0 --00 -0-0 0eh ? unimplemented ? ? 0fh tmr1l holding register for the least significant byte of the 16-bit tmr1 xxxx xxxx uuuu uuuu 10h tmr1h holding register for the most significant byte of the 16-bit tmr1 xxxx xxxx uuuu uuuu 11h t1con tmr1cs<1:0> t1ckps<1:0> reserved t1sync ? tmr1on 0000 00-0 uuuu uu-u 12h t1gcon tmr1ge t1gpol t1gtm t1gspm t1ggo/ done t1gval t1gss<1:0> 0000 0x00 uuuu uxuu 13h ccpr1l capture/compare/pwm register1 low byte xxxx xxxx uuuu uuuu 14h ccpr1h capture/compare/pwm register1 high byte xxxx xxxx uuuu uuuu 15h ccp1con ? ? dc1b<1:0> ccp1m<3:0> --00 0000 --00 0000 16h to 1bh ? unimplemented ? ? 1ch adresl least significant 2 bits of the left shifted result or 8 bits of the right shifted result xxxx xxxx uuuu uuuu 1dh adresh most significant 8 bits of the left shifted a/d result or 2 bits of right shifted result xxxx xxxx uuuu uuuu 1eh adcon0 adfm vcfg chs<3:0> go/done adon 0000 0000 0000 0000 1fh adcon1 ? adcs<2:0> ? ? ? ? -000 ---- -000 ---- legend: ? = unimplemented locations read as ? 0 ?, u = unchanged, x = unknown, q = value depends on condition shaded = unimplemented note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation. 2: mclr and wdt reset does not affect the previous value data latch. the iocif bit will be cleared upon reset but will set again if th e mismatch exists.
? 2011 microchip technology inc. preliminary ds41576b-page 15 pic12f752/hv752 table 2-2: pic12f752/hv752 special registers summary bank 1 addr name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por/bor reset values on all other resets (1) bank 1 80h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx uuuu uuuu 81h option_reg rapu intedg t0cs t0se psa ps<2:0> 1111 1111 1111 1111 82h pcl program counter's (pc) least significant byte 0000 0000 0000 0000 83h status irp rp1 rp0 to pd zdcc 0001 1xxx 000q quuu 84h fsr indirect data memory address pointer xxxx xxxx uuuu uuuu 85h trisa ? ? trisa5 trisa4 trisa3 (3) trisa2 trisa1 trisa0 --11 1111 --11 1111 86h ? unimplemented ? ? 87h ? unimplemented ? ? 88h iocap ? ? iocap5 iocap4 iocap3 iocap2 iocap1 iocap0 --00 0000 --00 0000 89h ? unimplemented ? ? 8ah pclath ? ? ? write buffer for upper 5 bits of program counter ---0 0000 ---0 0000 8bh intcon gie peie t0ie inte iocie t0if intf iocif (2) 0000 0000 0000 0000 8ch pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 00-- -000 00-- -000 8dh pie2 ? ? c2ie c1ie ? cog1ie ? ccp1ie --00 -0-0 --00 -0-0 8eh ? unimplemented ? ? 8fh osccon ? ? ircf<1:0> ? hts lts ? --01 -00- --uu -uu- 90h fvrcon fvren fvrrdy fvr- bufen fvr- bufss ? ? ? ? 0000 ---- 0000 ---- 91h daccon0 dacen dacrng dacoe ? ? dacpss0 ? ? 000- -0-- 000- -0-- 92h daccon1 ? ? ? dacr<4:0> ---0 0000 ---0 0000 93h to 9ah ? unimplemented ? ? 9bh cm2con0 c2on c2out c2oe c2pol c2zlf c2sp c2hys c2sync 0000 0100 0000 0100 9ch cm2con1 c2intp c2intn c2pch<1:0> ? ? ? c2nch0 0000 ---0 0000 ---0 9dh cm1con0 c1on c1out c1oe c1pol c1zlf c1sp c1hys c1sync 0000 0100 0000 0100 9eh cm1con1 c1intp c1intn c1pch<1:0> ? ? ? c1nch0 0000 ---0 0000 ---0 9fh cmout ? ? ? ? ? ? mc2out mc1out ---- --00 ---- --00 legend: ? = unimplemented locations read as ? 0 ?, u = unchanged, x = unknown, q = value depends on condition shaded = unimplemented note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation. 2: mclr and wdt reset does not affect the previous value data latch. the iocif bit will be cleared upon reset but will set again if th e mismatch exists. 3: trisa3 always reads ? 1 ?.
pic12f752/hv752 ds41576b-page 16 preliminary ? 2011 microchip technology inc. table 2-3: pic12f752/hv752 special registers summary bank 2 adr name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por/bor reset value on all other resets (1) bank 2 100h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx xxxx xxxx 101h tmr0 holding register for the 8-bit timer0 register xxxx xxxx uuuu uuuu 102h pcl program counter's (pc) least significant byte 0000 0000 0000 0000 103h status irp rp1 rp0 to pd zdcc 0001 1xxx 000q quuu 104h fsr indirect data memory address pointer xxxx xxxx uuuu uuuu 105h lata ? ?lata5lata4 ? lata2 lata1 lata0 --xx -xxx --uu -uuu 106h ? unimplemented ? ? 107h ? unimplemented ? ? 108h iocan ? ? iocan5 iocan4 iocan3 iocan2 iocan1 iocan0 --00 0000 --00 0000 109h ? unimplemented ? ? 10ah pclath ? ? ? write buffer for upper 5 bits of program counter ---0 0000 ---0 0000 10bh intcon gie peie t0ie inte iocie t0if intf iocif (2) 0000 0000 0000 0000 10ch wpua ? ? wpua5 wpua4 wpua3 wpua2 wpua1 wpua0 --00 0000 --00 0000 10dh slrcona ? ? ? ? ?slra2 ?slra0 ---- -0-0 ---- -0-0 10eh ? unimplemented ? ? 10fh pcon ? ? ? ? ? ?por bor ---- --qq ---- --uu 110h tmr2 holding register for the 8-bit timer2 register 0000 0000 0000 0000 111h pr2 timer2 period register 1111 1111 1111 1111 112h t2con ? toutps<3:0> tmr2on t2ckps<1:0> -000 0000 -000 0000 113h hltmr1 holding register for the 8-bit hardware limit timer1 register 0000 0000 0000 0000 114h hltpr1 hardware limit timer1 period register 1111 1111 1111 1111 115h hlt1con0 ? h1outps<3:0> h1on h1ckps<1:0> -000 0000 -000 0000 116h hlt1con1 ? ? ? h1ers<2:0> h1feren h1reren ---0 0000 ---0 0000 117h to 11fh ? unimplemented ? ? legend: ? = unimplemented locations read as ?0?, u = unchanged, x = unknown, q = value depends on condition shaded = unimplemented note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation. 2: mclr and wdt reset does not affect the previous value data latch. the iocif bit will be cleared upon reset but will set again if th e mismatch exists.
? 2011 microchip technology inc. preliminary ds41576b-page 17 pic12f752/hv752 table 2-4: pic12f752/hv752 special function registers summary bank 3 addr name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por/bor reset values on all other resets (1) bank 3 180h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx uuuu uuuu 181h option_reg rapu intedg t0cs t0se psa ps<2:0> 1111 1111 1111 1111 182h pcl program counter's (pc) least significant byte 0000 0000 0000 0000 183h status irp rp1 rp0 to pd zdcc 0001 1xxx 000q quuu 184h fsr indirect data memory address pointer xxxx xxxx uuuu uuuu 185h ansela ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 --11 -111 --11 -111 186h ? unimplemented ? ? 187h ? unimplemented ? ? 188h apfcon ? ? ? t1gsel ? cog1fsel cog1o1sel cog1o0sel ---0 -000 ---0 -000 189h osctune ? ? ? tun<4:0> ---0 0000 ---u uuuu 18ah pclath ? ? ? write buffer for upper 5 bits of program counter ---0 0000 ---0 0000 18bh intcon gie peie t0ie inte iocie t0if intf iocif (2) 0000 0000 0000 0000 18ch pmcon1 ? ? ? ? ?wrenwr rd ---- -000 ---- -000 18dh pmcon2 program memory control register 2 (not a physical register) ---- ---- ---- ---- 18eh pmadrl program memory address register low byte 0000 0000 0000 0000 18fh pmadrh ? ? ? ? ? ? pmadrh<1:0> ---- --00 ---- --00 190h pmdatl program memory data register low byte 0000 0000 0000 0000 191h pmdath ? ? program memory data register high byte --00 0000 --00 0000 192h cog1ph ? ? ? ? g1ph<3:0> ---- xxxx ---- uuuu 193h cog1blk g1blkr<3:0> g1blkf<3:0> xxxx xxxx uuuu uuuu 194h cog1db g1dbr<3:0> g1dbf<3:0> xxxx xxxx uuuu uuuu 195h cog1con0 g1en g1oe1 g1oe0 g1pol1 g1pol0 g1ld g1cs<1:0> 0000 0000 0000 0000 196h cog1con1 g1fsim g1rsim g1fs<2:0> g1rs<2:0> 0000 0000 0000 0000 197h cog1asd g1asde g1arsen g1asdl1 g1asdl0 g1asdshlt g1asdsc2 g1asdsc1 g1asdsflt 0000 0000 0000 0000 198h to 19fh ? unimplemented ? ? legend: ? = unimplemented locations read as ?0?, u = unchanged, x = unknown, q = value depends on condition shaded = unimplemented note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation. 2: mclr and wdt reset does not affect the previous value data latch. the iocif bit will be cleared upon reset but will set again if th e mismatch exists.
pic12f752/hv752 ds41576b-page 18 preliminary ? 2011 microchip technology inc. 2.2.2.1 status register the status register, shown in register 2-1 , contains: ? the arithmetic status of the alu ? the reset status ? the bank select bits for data memory (ram) the status register can be the destination for any instruction, like any other register. if the status register is the destination for an instruction that affects the z, dc or c bits, then the write to these three bits is disabled. these bits are set or cleared according to the device logic. furthermore, the to and pd bits are not writable. therefore, the result of an instruction with the status register as destination may be different than intended. for example, clrf status, will clear the upper three bits and set the z bit. this leaves the status register as ?000u u1uu? (where u = unchanged). it is recommended, therefore, that only bcf, bsf, swapf and movwf instructions are used to alter the status register, because these instructions do not affect any status bits. for other instructions not affecting any status bits, see the section 16.0 ?instruction set summary? . register 2-1: status: status register r/w-0 r/w-0 r/w-0 r-1 r-1 r/w-x r/w-x r/w-x irp rp1 rp0 to pd zdc (1) c (1) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 irp: register bank select bit (used for indirect addressing) 1 = bank 2, 3 (100h-1ffh) 0 = bank 0, 1 (00h-ffh) bit 6 rp1: register bank select bit (used for direct addressing) 00 = bank 0 (00h-7fh) 01 = bank 1 (80h-ffh) 10 = bank 2 (100h-17fh) 11 = bank 3 (180h-1ffh) bit 5 rp0: register bank select bit (used for direct addressing) 1 = bank 1 (80h-ffh) 0 = bank 0 (00h-7fh) bit 4 to : time-out bit 1 = after power-up, clrwdt instruction or sleep instruction 0 = a wdt time-out occurred bit 3 pd : power-down bit 1 = after power-up or by the clrwdt instruction 0 = by execution of the sleep instruction bit 2 z: zero bit 1 = the result of an arithmetic or logic operation is zero 0 = the result of an arithmetic or logic operation is not zero bit 1 dc: digit carry/borrow bit (2) ( addwf , addlw,sublw,subwf instructions), for borrow , the polarity is reversed. 1 = a carry-out from the 4th low-order bit of the result occurred 0 = no carry-out from the 4th low-order bit of the result bit 0 c: carry/borrow bit (2) ( addwf , addlw, sublw, subwf instructions) 1 = a carry-out from the most significant bit of the result occurred 0 = no carry-out from the most significant bit of the result occurred note 1: the c and dc bits operate as a borrow and digit borrow out bit, respectively, in subtraction. see the sublw and subwf instructions for examples. 2: for borrow , the polarity is reversed. a subtraction is executed by adding the two?s complement of the second operand. for rotate ( rrf , rlf ) instructions, this bit is loaded with either the hi gh-order or low-order bit of the source register.
? 2011 microchip technology inc. preliminary ds41576b-page 19 pic12f752/hv752 2.2.2.2 option register the option register is a readable and writable register, which contains various control bits to configure: ? timer0/wdt prescaler ? external ra2/int interrupt ?timer0 ? weak pull-ups on porta note: to achieve a 1:1 prescaler assignment for timer0, assign the prescaler to the wdt by setting psa bit to ? 1 ? of the option register. see section 6.1.3 ?software programmable prescaler? . register 2-2: option_reg: option register r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 rapu intedg t0cs t0se psa ps<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 rapu : porta pull-up enable bit 1 = porta pull-ups are disabled 0 = porta pull-ups are enabled by individual port latch values bit 6 intedg: interrupt edge select bit 1 = interrupt on rising edge of int pin 0 = interrupt on falling edge of int pin bit 5 t0cs: timer0 clock source select bit 1 = transition on t0cki pin 0 = internal instruction cycle clock (f osc /4) bit 4 t0se: timer0 source edge select bit 1 = increment on high-to-low transition on t0cki pin 0 = increment on low-to-high transition on t0cki pin bit 3 psa: prescaler assignment bit 1 = prescaler is assigned to the wdt 0 = prescaler is assigned to the timer0 module bit 2-0 ps<2:0>: prescaler rate select bits 000 001 010 011 100 101 110 111 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 1 : 1 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 bit value timer0 rate wdt rate
pic12f752/hv752 ds41576b-page 20 preliminary ? 2011 microchip technology inc. 2.2.2.3 intcon register the intcon register is a readable and writable register, which contains the various enable and flag bits for tmr0 register overflow, iocie change and external ra2/int pin interrupts. note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie of the intcon register. user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. register 2-3: intcon: interrupt control register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 gie peie t0ie inte iocie t0if intf iocif bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 gie: global interrupt enable bit 1 = enables all unmasked interrupts 0 = disables all interrupts bit 6 peie: peripheral interrupt enable bit 1 = enables all unmasked peripheral interrupts 0 = disables all peripheral interrupts bit 5 t0ie: timer0 overflow interrupt enable bit 1 = enables the timer0 interrupt 0 = disables the timer0 interrupt bit 4 inte: ra2/int external interrupt enable bit 1 = enables the ra2/int external interrupt 0 = disables the ra2/int external interrupt bit 3 iocie: interrupt-on-change interrupt enable bit (1) 1 = enables the ioc change interrupt 0 = disables the ioc change interrupt bit 2 t0if: timer0 overflow interrupt flag bit (2) 1 = timer0 register has overflowed (must be cleared in software) 0 = timer0 register did not overflow bit 1 intf: ra2/int external interrupt flag bit 1 = the ra2/int external interrupt occurred (must be cleared in software) 0 = the ra2/int external interrupt did not occur bit 0 iocif: interrupt-on-change interrupt flag bit 1 = an ioc pin has changed state and generated an interrupt 0 = no pin interrupts have been generated note 1: ioc register must also be enabled. 2: t0if bit is set when tmr0 rolls over. tmr0 is unchanged on reset and should be initialized before clearing t0if bit.
? 2011 microchip technology inc. preliminary ds41576b-page 21 pic12f752/hv752 2.2.2.4 pie1 register the pie1 register contains the peripheral interrupt enable bits, as shown in register 2-4 . note: bit peie of the intcon register must be set to enable any peripheral interrupt. register 2-4: pie1: peripheral interrupt enable register 1 r/w-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 tmr1gie: adc interrupt enable bit 1 = enables the tmr1 gate interrupt 0 = disables the tmr1 gate interrupt bit 6 adie: adc interrupt enable bit 1 = enables the adc interrupt 0 = disables the adc interrupt bit 5-3 unimplemented: read as ? 0 ? bit 2 hltmr1ie: hardware limit timer1 interrupt enable bit 1 = enables the hltmr1 interrupt 0 = disables the hltmr1 interrupt bit 1 tmr2ie: timer2 interrupt enable bit 1 = enables the timer2 interrupt 0 = disables the timer2 interrupt bit 0 tmr1ie: timer1 interrupt enable bit 1 = enables the timer1 interrupt 0 = disables the timer1 interrupt
pic12f752/hv752 ds41576b-page 22 preliminary ? 2011 microchip technology inc. 2.2.2.5 pie2 register the pie2 register contains the peripheral interrupt enable bits, as shown in register 2-5 . note: bit peie of the intcon register must be set to enable any peripheral interrupt. register 2-5: pie2: peripheral interrupt enable register 1 u-0 u-0 r/w-0 r/w-0 u-0 r/w-0 u-0 r/w-0 ? ? c2ie c1ie ?cog1ie ? ccp1ie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 unimplemented: read as ? 0 ? bit 5 c2ie: comparator 2 interrupt enable bit 1 = enables the comparator 2 interrupt 0 = disables the comparator 2 interrupt bit 4 c1ie: comparator 1 interrupt enable bit 1 = enables the comparator 1 interrupt 0 = disables the comparator 1 interrupt bit 3 unimplemented: read as ? 0 ? bit 2 cog1ie: cog 1 interrupt flag bit 1 = cog1 interrupt enabled 0 = cog1 interrupt disabled bit 1 unimplemented: read as ? 0 ? bit 0 ccp1ie: ccp1 interrupt enable bit 1 = enables the ccp1 interrupt 0 = disables the ccp1 interrupt
? 2011 microchip technology inc. preliminary ds41576b-page 23 pic12f752/hv752 2.2.2.6 pir1 register the pir1 register contains the peripheral interrupt flag bits, as shown in register 2-6 . note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie of the intcon register. user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. register 2-6: pir1: peripheral interrupt request register 1 r/w-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 tmr1gif: tmr1 gate interrupt flag bit 1 = timer1 gate interrupt is pending 0 = timer1 gate interrupt is not pending bit 6 adif: adc interrupt flag bit 1 = adc conversion complete 0 = adc conversion has not completed or has not been started bit 5-3 unimplemented: read as ? 0 ? bit 2 hltmr1if: hardware limit timer1 to hltpr1 match interrupt flag bit 1 = hltmr1 to hltpr1 match occurred (must be cleared in software) 0 = hltmr1 to hltpr1 match did not occur bit 1 tmr2if: timer2 to pr2 match interrupt flag bit 1 = timer2 to pr2 match occurred (must be cleared in software) 0 = timer2 to pr2 match did not occur bit 0 tmr1if: timer1 interrupt flag bit 1 = timer1 rolled over (must be cleared in software) 0 = timer1 has not rolled over
pic12f752/hv752 ds41576b-page 24 preliminary ? 2011 microchip technology inc. 2.2.2.7 pir2 register the pir2 register contains the peripheral interrupt flag bits, as shown in register 2-7 . note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie of the intcon register. user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. register 2-7: pir2: peripheral interrupt request register 1 u-0 u-0 r/w-0 r/w-0 u-0 r/w-0 u-0 r/w-0 ? ? c2if c1if cog1if ? ccp1if bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 unimplemented: read as ? 0 ? bit 5 c2if: comparator 1 interrupt flag bit 1 = comparator output (c2out bit) has changed (must be cleared in software) 0 = comparator output (c2out bit) has not changed bit 4 c1if: comparator 1 interrupt flag bit 1 = comparator output (c1out bit) has changed (must be cleared in software) 0 = comparator output (c1out bit) has not changed bit 3 unimplemented: read as ? 0 ? bit 2 cog1if: cog 1 interrupt flag bit 1 = cog1 has generated an auto-shutdown interrupt 0 = cog1 has not generated an auto-shutdown interrupt bit 1 unimplemented: read as ? 0 ? bit 0 ccp1if: eccp interrupt flag bit capture mode 1 = a tmr1 register capture occurred (must be cleared in software) 0 = no tmr1 register capture occurred compare mode 1 = a tmr1 register compare match occurred (must be cleared in software) 0 = no tmr1 register compare match occurred pwm mode unused in this mode
? 2011 microchip technology inc. preliminary ds41576b-page 25 pic12f752/hv752 2.2.2.8 pcon register the power control (pcon) register (see tab l e 1 7- 2 ) contains flag bits to differentiate between a: ? power-on reset (por ) ? brown-out reset (bor ) ? watchdog timer reset (wdt) ? external mclr reset the pcon register also controls the software enable of the bor . the pcon register bits are shown in register 2-8 . register 2-8: pcon: power control register u-0 u-0 u-0 u-0 u-0 u-0 r/w-q/u r/w-q/u ? ? ? ? ? ?por bor bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = unchanged bit 7-2 unimplemented: read as ? 0 ? bit 1 por : power-on reset status bit 1 = no power-on reset occurred 0 = a power-on reset occurred (must be set in software after a power-on reset occurs) bit 0 bor : brown-out reset status bit 1 = no brown-out reset occurred 0 = a brown-out reset occurred (must be set in software after a brown-out reset occurs)
pic12f752/hv752 ds41576b-page 26 preliminary ? 2011 microchip technology inc. 2.3 pcl and pclath the program counter (pc) is 13 bits wide. the low byte comes from the pcl register, which is a readable and writable register. the high byte (pc<12:8>) is not directly readable or writable and comes from pclath. on any reset, the pc is cleared. figure 2-3 shows the two situations for the loading of the pc. the upper example in figure 2-3 shows how the pc is loaded on a write to pcl (pclath<4:0> ? pch). the lower example in figure 2-3 shows how the pc is loaded during a call or goto instruction (pclath<4:3> ? pch). figure 2-3: loading of pc in different situations 2.3.1 modifying pcl executing any instruction with the pcl register as the destination simultaneously causes the program counter pc<12:8> bits (pch) to be replaced by the contents of the pclath register. this allows the entire contents of the program counter to be changed by writing the desired upper 5 bits to the pclath register. when the lower 8 bits are written to the pcl register, all 13 bits of the program counter will change to the values contained in the pclath register and those being written to the pcl register. a computed goto is accomplished by adding an offset to the program counter ( addwf pcl ). care should be exercised when jumping into a look-up table or program branch table (computed goto ) by modifying the pcl register. assuming that pclath is set to the table start address, if the table length is greater than 255 instructions or if the lower 8 bits of the memory address rolls over from 0xff to 0x00 in the middle of the table, then pclath must be incremented for each address rollover that occurs between the table beginning and the target location within the table. for more information refer to application note an556, ? implementing a table read ? (ds00556). 2.3.2 stack the pic12f752/hv752 family has an 8-level x 13-bit wide hardware stack (see figure 2-1 ). the stack space is not part of either program or data space and the stack pointer is not readable or writable. the pc is pushed onto the stack when a call instruction is exe- cuted or an interrupt causes a branch. the stack is poped in the event of a return, retlw or a retfie instruction execution. pclath is not affected by a push or pop operation. the stack operates as a circular buffer. this means that after the stack has been pushed eight times, the ninth push overwrites the value that was stored from the first push. the tenth push overwrites the second push (and so on). 2.4 indirect addressing, indf and fsr registers the indf register is not a physical register. addressing the indf register will cause indirect addressing. indirect addressing is possible by using the indf register. any instruction using the indf register actually accesses data pointed to by the file select register (fsr). reading indf itself indirectly will produce 00h. writing to the indf register indirectly results in a no operation (although status bits may be affected). an effective 9-bit address is obtained by concatenating the 8-bit fsr and the irp bit of the status register, as shown in figure 2-4 . a simple program to clear ram location 40h-7fh using indirect addressing is shown in example 2-1 . example 2-1: indirect addressing pc 12 8 7 0 5 pclath<4:0> pclath instruction with alu result goto, call opcode <10:0> 8 pc 12 11 10 0 11 pclath<4:3> pch pcl 87 2 pclath pch pcl pcl as destination note 1: there are no status bits to indicate stack overflow or stack underflow conditions. 2: there are no instructions/mnemonics called push or pop. these are actions that occur from the execution of the call, return, retlw and retfie instructions or the vectoring to an interrupt address. movlw 0x40 ;initialize pointer movwf fsr ;to ram next clrf indf ;clear indf register incf fsr ;inc pointer btfss fsr,7 ;all done? goto next ;no clear next continue ;yes continue
? 2011 microchip technology inc. preliminary ds41576b-page 27 pic12f752/hv752 figure 2-4: direct/indirect addressing pic12f752/hv752 data memory indirect addressing direct addressing bank select location select rp1 rp0 6 0 from opcode irp file select register 7 0 bank select location select 00 01 10 11 180h 1ffh 00h 7fh bank 0 bank 1 bank 2 bank 3 for memory map detail, see figure 2-2 .
pic12f752/hv752 ds41576b-page 28 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 29 pic12f752/hv752 3.0 flash program memory self read/self write control the flash program memory is readable and writable during normal operation (full v dd range). this memory is not directly mapped in the register file space. instead, it is indirectly addressed through the special function registers (see registers 3-1 to 3-5 ). there are six sfrs used to read and write this memory: ?pmcon1 ?pmcon2 ?pmdatl ?pmdath ? pmadrl ? pmadrh when interfacing the program memory block, the pmdatl and pmdath registers form a two-byte word which holds the 14-bit data for read/write, and the pmadrl and pmadrh registers form a two-byte word which holds the 10-bit address of the flash loca- tion being accessed. these devices have 1k words of program flash with an address range from 0000h to 03ffh. the program memory allows single word read and a by four word write. a four word write automatically erases the row of the location and writes the new data (erase before write). the write time is controlled by an on-chip timer. the write/erase voltages are generated by an on-chip charge pump rated to operate over the voltage range of the device for byte or word operations. when the device is code-protected, the cpu may continue to read and write the flash program memory. depending on the settings of the flash program memory enable (wrt<1:0>) bits, the device may or may not be able to write certain blocks of the program memory, however, reads of the program memory are allowed. when the flash program memory code protection (cp ) bit in the configuration word register is enabled, the program memory is code-protected, and the device programmer (icsp?) cannot access data or program memory. 3.1 pmadrh and pmadrl registers the pmadrh and pmadrl registers can address up to a maximum of 1k words of program memory. when selecting a program address value, the most significant byte (msb) of the address is written to the pmadrh register and the least significant byte (lsb) is written to the pmadrl register. 3.2 pmcon1 and pmcon2 registers pmcon1 is the control register for the data program memory accesses. control bits rd and wr initiate read and write, respectively. these bits cannot be cleared, only set in software. they are cleared in hardware at completion of the read or write operation. the inability to clear the wr bit in software prevents the accidental premature termination of a write operation. the wren bit, when set, will allow a write operation. on power-up, the wren bit is clear. pmcon2 is not a physical register. reading pmcon2 will read all ? 0 ?s. the pmcon2 register is used exclusively in the flash memory write sequence.
pic12f752/hv752 ds41576b-page 30 preliminary ? 2011 microchip technology inc. 3.3 flash program memory control registers register 3-1: pmdatl: program memory data low byte register register 3-2: pmadrl: program me mory address low byte register register 3-3: pmdath: program memory data high byte register register 3-4: pmadrh: program memory address high byte register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pmdatl<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-0 pmdatl<7:0> : 8 least significant data bits to write or read from program memory r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pmadrl<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-0 pmadrl<7:0> : 8 least significant address bits for program memory read/write operation u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ?pmdath<5:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 unimplemented: read as ? 0 ? bit 5-0 pmdath<5:0> : 6 most significant data bits from program memory u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 ? ? ? ? ? ? pmadrh<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-2 unimplemented: read as ? 0 ? bit 1-0 pmadrh<1:0> : specifies the 2 most significant address bits or high bits for program memory reads.
? 2011 microchip technology inc. preliminary ds41576b-page 31 pic12f752/hv752 register 3-5: pmcon1: progra m memory control 1 register u-0 u-0 u-0 u-0 u-0 r/w-0/0 r/s/hc-0/0 r/s/hc-0/0 ? ? ? ? ?wrenwr rd bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? s = bit can only be set x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared hc = bit is cleared by hardware bit 7-3 unimplemented: read as ? 0 ? bit 2 wren: program/erase enable bit 1 = allows program/erase cycles 0 = inhibits programming/erasing of program flash bit 1 wr: write control bit 1 = initiates a program flash program/erase operation the operation is self-timed and the bit is cleared by hardware once operation is complete. the wr bit can only be set (not cleared) in software. 0 = program/erase operation to the flash is complete and inactive bit 0 rd: read control bit 1 = initiates a program flash read. read takes one cycle. rd is cleared in hardware. the rd bit can only be set (not cleared) in software. 0 = does not initiate a program flash read note 1: unimplemented bit, read as ? 1 ?.
pic12f752/hv752 ds41576b-page 32 preliminary ? 2011 microchip technology inc. 3.4 reading the flash program memory to read a program memory location, the user must write two bytes of the address to the pmadrl and pmadrh registers, and then set control bit rd (pmcon1<0>). once the read control bit is set, the program memory flash controller will use the second instruction cycle after to read the data. this causes the second instruction immediately following the ? bsf pmcon1,rd ? instruction to be ignored. the data is available in the very next cycle in the pmdatl and pmdath registers; it can be read as two bytes in the following instructions. pmdatl and pmdath regis- ters will hold this value until another read or until it is written to by the user (during a write operation). example 3-1: flash program read banksel pm_adr ; change status bits rp1:0 to select bank with pmadrl movlw ms_prog_pm_addr ; movwf pmadrh ; ms byte of program address to read movlw ls_prog_pm_addr ; movwf pmadrl ; ls byte of program address to read banksel pmcon1 ; bank to containing pmcon1 bsf pmcon1, rd ; pm read nop ; first instruction after bsf pmcon1,rd executes normally nop ; any instructions here are ignored as program ; memory is read in second cycle after bsf pmcon1,rd ; banksel pmdatl ; bank to containing pmadrl movf pmdatl, w ; w = ls byte of program pmdatl movf pmdath, w ; w = ms byte of program pmdatl
? 2011 microchip technology inc. preliminary ds41576b-page 33 pic12f752/hv752 figure 3-1: flash program me mory read cycle execution q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 bsf pmcon1,rd executed here instr (pc + 1) executed here nop executed here pc pc + 1 pmadrh,pmadrl pc+3 pc + 5 flash addr rd bit instr (pc) pmdath,pmdatl instr (pc + 3) pc + 3 pc + 4 instr (pc + 4) instr (pc + 1) instr (pc - 1) executed here instr (pc + 3) executed here instr (pc + 4) executed here flash data pmdath pmdatl register pmrhlt
pic12f752/hv752 ds41576b-page 34 preliminary ? 2011 microchip technology inc. 3.5 writing the flash program memory a word of the flash program memory may only be written to if the word is in an unprotected segment of memory. flash program memory must be written in four-word blocks. see figure 3-2 and figure 3-3 for more details. a block consists of four words with sequential addresses, with a lower boundary defined by an address, where pmadrl<1:0> = 00 . all block writes to program memory are done as 16-word erase by four- word write operations. the write operation is edge- aligned and cannot occur across boundaries. to write program data, it must first be loaded into the buffer registers (see figure 3-2 ). this is accomplished by first writing the destination address to pmadrl and pmadrh and then writing the data to pmdatl and pmdath. after the address and data have been set up, then the following sequence of events must be executed: 1. write 55h, then aah, to pmcon2 (flash programming sequence). 2. set the wr control bit of the pmcon1 register. all four buffer register locations should be written to with correct data. if less than four words are being written to in the block of four words, then a read from the program memory location(s) not being written to must be performed. this takes the data from the program location(s) not being written and loads it into the pmdatl and pmdath registers. then the sequence of events to transfer data to the buffer registers must be executed. to transfer data from the buffer registers to the program memory, the pmadrl and pmadrh must point to the last location in the four-word block (pmadrl<1:0> = 11 ). then the following sequence of events must be executed: 1. write 55h, then aah, to pmcon2 (flash pro- gramming sequence). 2. set control bit wr of the pmcon1 register to begin the write operation. the user must follow the same specific sequence to initiate the write for each word in the program block, writing each program word in sequence ( 000 , 001 , 010 , 011 ). when the write is performed on the last word (pmadrl<1:0> = 11 ), a block of sixteen words is automatically erased and the content of the four-word buffer registers are written into the program memory. after the ? bsf pmcon1,wr ? instruction, the processor requires two cycles to set up the erase/write operation. the user must place two nop instructions after the wr bit is set. since data is being written to buffer registers, the writing of the first three words of the block appears to occur immediately. the processor will halt internal operations for the typical 4 ms, only during the cycle in which the erase takes place (i.e., the last word of the sixteen-word block erase). this is not sleep mode as the clocks and peripherals will continue to run. after the four-word write cycle, the processor will resume operation with the third instruction after the pmcon1 write instruction. the above sequence must be repeated for the higher 12 words. 3.6 protection against spurious write there are conditions when the device should not write to the program memory. to protect against spurious writes, various mechanisms have been built in. on power-up, wren is cleared. also, the power-up timer (64 ms duration) prevents program memory writes. the write initiate sequence and the wren bit help prevent an accidental write during brown-out, power glitch or software malfunction. 3.7 operation during code-protect when the device is code-protected, the cpu is able to read and write unscrambled data to the program memory. 3.8 operation during write protect when the program memory is write-protected, the cpu can read and execute from the program memory. the portions of program memory that are write pro- tected can be modified by the cpu using the pmcon registers, but the protected program memory cannot be modified using icsp mode.
? 2011 microchip technology inc. preliminary ds41576b-page 35 pic12f752/hv752 figure 3-2: block writes to 1k flash program memory figure 3-3: flash program memory long write cycle execution 14 14 14 14 program memory buffer register pmadrl<1:0> = 00 buffer register pmadrl<1:0> = 01 buffer register pmadrl<1:0> = 10 buffer register pmadrl<1:0> = 11 pmdatl pmdath 75 07 0 6 8 first word of block to be written if at a new row to flash automatically after this word is written are transferred flash are erased, then four buffers sixteen words of q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 bsf pmcon1,wr executed here instr (pc + 1) executed here pc + 1 flash instr pmdath,pmdatl instr (pc+3) instr nop executed here flash flash pmwhlt wr bit processor halted pm write time pmadrh,pmadrl pc + 3 pc + 4 instr (pc + 3) executed here addr data memory location ignored read pc + 2 instr (pc+2) (instr (pc + 2) nop executed here (pc) (pc + 1)
pic12f752/hv752 ds41576b-page 36 preliminary ? 2011 microchip technology inc. an example of the complete four-word write sequence is shown in example 3-2 . the initial address is loaded into the pmadrh and pmadrl register pair; the four words of data are loaded using indirect addressing. example 3-2: writing to flash program memory ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; this write routine assumes the following: ; a valid starting address (the least significant bits = '00') ; is loaded in addrh:addrl ; addrh, addrl and dataddr are all located in data memory ; banksel pmadrh movf addrh,w ;load initial address movwf pmadrh ; movf addrl,w ; movwf pmadrl ; movf dataaddr,w ;load initial data address movwf fsr ; loop movf indf,w ;load first data byte into lower movwf pmdatl ; incf fsr,f ;next byte movf indf,w ;load second data byte into upper movwf pmdath ; incf fsr,f ; banksel pmcon1 bsf pmcon1,wren ;enable writes bcf intcon,gie ;disable interrupts (if using) btfsc intcon,gie ;see an576 goto $-2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; required sequence movlw 55h ;start of required write sequence: movwf pmcon2 ;write 55h movlw 0aah ; movwf pmcon2 ;write 0aah bsf pmcon1,wr ;set wr bit to begin write nop ;required to transfer data to the buffer nop ;registers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; bcf pmcon1,wren ;disable writes bsf intcon,gie ;enable interrupts (comment out if not using interrupts) banksel pmadrl movf pmadrl, w incf pmadrl,f ;increment address andlw 0x03 ;indicates when sixteen words have been programmed sublw 0x03 ;change value for different size write blocks ;0x0f = 16 words ;0x0b = 12 words ;0x07 = 8 words ;0x03 = 4 words btfss status,z ;exit on a match, goto loop ;continue if more data needs to be written
? 2011 microchip technology inc. preliminary ds41576b-page 37 pic12f752/hv752 table 3-1: summary of registers asso ciated with flash program memory table 3-2: summary of co nfiguration word with flash program memory name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page pmcon1 ? ? ? ? ? wren wr rd 31 pmcon2 program memory control register 2 29 * pmadrl pmadrl<7:0> 30 pmadrh ? ? ? ? ? ? pmadrh<1:0> 30 pmdatl pmdatl<7:0> 30 pmdath ? ? pmdath<5:0> 30 intcon gie peie t0ie inte iocie t0if intf iocif 20 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by flash program memory module. * page provides register information. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? debug clkouten wrt<1:0> boren<1:0> 142 7:0 ?cp mclre pwrte wdte ? ? fosc0 legend: ? = unimplemented location, read as ? 1 ?. shaded cells are not used by flash program memory.
pic12f752/hv752 ds41576b-page 38 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 39 pic12f752/hv752 4.0 oscillator module 4.1 overview the oscillator module has a variety of clock sources and selection features that allow it to be used in a wide range of applications while maximizing performance and minimizing power consumption. figure 4-1 illustrates a block diagram of the oscillator module. the oscillator module can be configured in one of two clock modes. 1. ec (external clock) 2. intosc (internal oscillator) clock source modes are configured by the fosc bit in the configuration word register (config). the internal oscillator module provides the following selectable system clock modes: ? 8 mhz (hfintosc) ? 4 mhz (hfintosc postscaler) ? 1 mhz (hfintosc postscaler) ? 31 khz (lfintosc) figure 4-1: pic ? mcu clock source block diagram figure 4-2: oscillator enable (cpu and clkin ec system clock mux fosc internal oscillator hfintosc 8 mhz lfintosc 31 khz prescaler 1 2 8 0 1 ircf<1:0> 00 01 10 11 cog clock source hfintosc enable ( figure 4-2 ) wdt clock source lfintosc enable ( figure 4-2 ) peripherals) ec enable ( figure 4-2 ) fosc0 sleep hfintosc enable ircf<1:0> ? 00 fosc0 sleep ec enable fosc0 sleep lfintosc enable ircf<1:0> = 00 wdte
pic12f752/hv752 ds41576b-page 40 preliminary ? 2011 microchip technology inc. 4.2 clock source modes clock source modes can be classified as external or internal: ? the external clock mode relies on an external clock for the clock source. for example, a clock module or clock output from another circuit. ? internal clock sources are contained internally within the oscillator module. the oscillator module has four selectable clock frequencies: -8mhz -4mhz -1mhz -31khz the system clock can be selected between external or internal clock sources via the fosc0 bit of the config- uration word register (config). 4.2.1 ec mode the external clock (ec) mode allows an externally generated logic as the system clock source. the ec clock mode is selected when the fosc0 bit of the configuration word is set. when operating in this mode, an external clock source must be connected to the clkin input. the clkout is available for either general purpose i/o or system clock output. figure 4-3 shows the pin connections for ec mode. because the pic ? mcu design is fully static, stopping the external clock input will have the effect of halting the device while leaving all data intact. upon restarting the external clock, the device will resume operation as if no time had elapsed. figure 4-3: extern al clock (ec) mode operation 4.2.2 internal clock mode internal clock mode configures the internal oscillators as the system clock source. the internal clock mode is selected when the fosc0 bit of the configuration word is cleared. the source and frequency are selected with the ircf<1:0> bits of the osccon register. when one of the hfintosc frequencies is selected, the frequency of the internal oscillator can be trimmed by adjusting the tun<4:0> bits of the osctune register. operation after a power-on reset (por) or wake-up from sleep is delayed by the oscillator start-up time. delays are typically longer for the lfintosc than hfintosc because of the very low-power operation and relatively narrow bandwidth of the lf internal oscillator. however, when another peripheral keeps the oscillator running during sleep, the start-up time is delayed to allow the memory bias to stabilize. figure 4-4: internal clock mode operation 4.2.2.1 oscillator ready bits the hts and lts bits of the osccon register indicate the status of the hfintosc and lfintosc, respectively. when either bit is set, it indicates that the corresponding oscillator is running and stable. clkin clkout (1) i/o clock from ext. system pic ? mcu note 1: alternate pin functions are listed in the section 1.0 ?device overview? . clkout (1) i/o pic ? mcu note 1: alternate pin functions are listed in the section 1.0 ?device overview? . i/o clkin (1)
? 2011 microchip technology inc. preliminary ds41576b-page 41 pic12f752/hv752 4.3 system clock output the clkout pin is available for general purpose i/o or system clock output. the clkouten bit of the configuration word controls the function of the clkout pin. when the clkouten bit is cleared, the clkout pin is driven by the selected internal oscillator frequency divided by 4. the corresponding i/o pin always reads ? 0 ? in this configuration. the clkout signal may be used to provide a clock for external circuitry, synchronization, calibration, test or other application requirements. when the clkouten bit is set, the system clock out function is disabled and the clkout pin is available for general purpose i/o. 4.4 oscillator delay upon wake-up, power-up, and base frequency change in applications where the osctune register is used to shift the hfintosc frequency, the application should not expect the frequency to stabilize immediately. in this case, the frequency may shift gradually toward the new value. the time for this frequency shift is less than eight cycles of the base frequency. a short delay is invoked upon power-up and when waking from sleep to allow the memory bias circuitry to stabilize. table 4-1 shows examples where the oscillator delay is invoked. table 4-1: oscillator delay examples switch from switch to frequency oscillator delay sleep/por intosc 31 khz to 8 mhz 10 ? s internal delay to allow memory bias to stabilize. sleep/por ec dc ? 20 mhz
pic12f752/hv752 ds41576b-page 42 preliminary ? 2011 microchip technology inc. 4.5 oscillator control registers register 4-1: osccon: os cillator control register u-0 u-0 r/w-0/u r/w-1/u u-0 r-0/u r-0/u u-0 ? ?ircf<1:0> ?htslts ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 unimplemented: read as ? 0 ? bit 5-4 ircf<1:0>: internal oscillator frequency select bits 11 = 8 mhz 10 = 4 mhz 01 = 1 mhz (reset default) 00 = 31 khz (lfintosc) bit 3 unimplemented: read as ? 0 ? bit 2 hts: hfintosc status bit 1 = hfintosc is stable 0 = hfintosc is not stable bit 1 lts: lfintosc status bit 1 = lfintosc is stable 0 = lfintosc is not stable bit 0 unimplemented: read as ? 0 ?
? 2011 microchip technology inc. preliminary ds41576b-page 43 pic12f752/hv752 4.5.1 osctune register the oscillator is factory calibrated, but can be adjusted in software by writing to the osctune register ( register 4-2 ). the default value of the osctune register is ? 0 ?. the value is a 5-bit two?s complement number. when the osctune register is modified, the frequency will begin shifting to the new frequency. code execution continues during this shift. there is no indication that the shift has occurred. table 4-2: summary of registers asso ciated with clock sources table 4-3: summary of conf iguration word clock sources register 4-2: osctune: osci llator tuning register u-0 u-0 u-0 r/w-0/u r/w-0/u r/w-0/u r/w-0/u r/w-0/u ? ? ? tun<4:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-5 unimplemented: read as ? 0 ? bit 4-0 tun<4:0>: frequency tuning bits 01111 = maximum frequency 01110 = ? ? ? 00001 = 00000 = oscillator module is running at the calibrated frequency. 11111 = ? ? ? 10000 = minimum frequency name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page osccon ? ?ircf<1:0> ?htslts ? 42 osctune ? ? ?tun<4:0> 43 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ? 0 ?. shaded cells are not used by oscillators. note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation. 2: see configuration word register ( register 17-1 ) for operation of all register bits. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? debug clkouten wrt<1:0> boren<1:0> 142 7:0 ? cp m clre pwrte wdte ? ?fosc0 legend: ? = unimplemented location, read as ? 1 ?. shaded cells are not us ed by oscillator module.
pic12f752/hv752 ds41576b-page 44 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 45 pic12f752/hv752 5.0 i/o ports for this device there is one port available, porta. in general, when a peripheral is enabled on a port pin, that pin cannot be used as a general purpose output. however, the pin can still be read. porta has three standard registers for its operation. these registers are: ? trisa registers (data direction) ? porta registers (reads the levels on the pins of the device) ? lata registers (output latch) some ports may have one or more of the following additional registers. these registers are: ? ansela (analog select) ? wpua (weak pull-up) the data latch (lata register) is useful for read- modify-write operations on the value that the i/o pins are driving. a write operation to the lata register has the same effect as a write to the corresponding porta register. a read of the lata register reads the values held in the i/o port latches, while a read of the porta register reads the actual i/o pin value. ports that support analog inputs have an associated ansel register. when an ansela bit is set, the digital input buffer associated with that bit is disabled. disabling the input buffer prevents analog signal levels on the pin between a logic high and low from causing excessive current in the logic input circuitry. a simplified model of a generic i/o port, without the interfaces to other peripherals, is shown in figure 5-1 . figure 5-1: generic i/o porta operation example 5-1: initializing porta q d ck write lata data register i/o pin read porta write porta trisa read lata data bus to peripherals ansela v dd v ss ; this code example illustrates ; initializing the porta register. the ; other ports are initialized in the same ; manner. banksel porta ; clrf porta ;init porta banksel lata ;data latch clrf lata ; banksel ansela ; clrf ansela ;digital i/o banksel trisa ; movlw b'00111000' ;set ra<5:3> as inputs movwf trisa ;and set ra<2:0> as ;outputs
pic12f752/hv752 ds41576b-page 46 preliminary ? 2011 microchip technology inc. 5.1 alternate pin function the alternate pin function control (apfcon) register is used to steer specific peripheral input and output functions between different pins. the apfcon register is shown in register 5-1 . for this device family, the following functions can be moved between different pins. ?timer1 gate ? cog1 these bits have no effect on the values of any tris register. port and tris overrides will be routed to the correct pin. the unselected pin will be unaffected. 5.2 alternate pin function control register register 5-1: apfcon: alternate pin function co ntrol register u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? t1gsel ? cog1fsel cog1o1sel cog1o0sel bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-5 unimplemented: read as ? 0 ?. bit 4 t1gsel: timer 1 gate input pin selection bit 1 = t1g function is on ra3 0 = t1g function is on ra4 bit 3 unimplemented: read as ? 0 ?. bit 2 cog1fsel: cog1 fault input pin selection bit 1 = cog1flt is on ra3 0 = cog1flt is on ra4 bit 1 cog1o1sel: cog1 output 1 pin selection bit 1 = cog1out1 is on ra4 0 = cog1out1 is on ra0 bit 0 cog1o0sel: cog1 output 0 pin selection bit 1 = cog1out0 is on ra5 0 = cog1out0 is on ra2
? 2011 microchip technology inc. preliminary ds41576b-page 47 pic12f752/hv752 5.3 porta and the trisa registers porta is a 6-bit wide port with 5 bidirectional and 1 input-only pin. the corresponding data direction register is trisa ( register 5-2 ). setting a trisa bit (= 1 ) will make the corresponding porta pin an input (i.e., disable the output driver). clearing a trisa bit (= 0 ) will make the corresponding porta pin an output (i.e., enables output driver and puts the contents of the output latch on the selected pin). the exception is ra3, which is input only and its tris bit will always read as ? 1 ?. example 5-1 shows how to initialize porta. reading the porta register ( register 5-2 ) reads the status of the pins, whereas writing to it will write to the port latch. all write operations are read-modify-write operations. therefore, a write to a port implies that the port pins are read, this value is modified and then written to the port data latch. ra3 reads ? 0 ? when mclre = 1 . the trisa register controls the direction of the porta pins, even when they are being used as analog inputs. the user must ensure the bits in the trisa register are maintained set when using them as analog inputs. i/o pins configured as analog input always read ? 0 ?. 5.3.1 porta functions and output priorities each porta pin is multiplexed with other functions. the pins, their combined functions and their output priorities are shown in tab l e 5 - 1 . when multiple outputs are enabled, the actual pin control goes to the peripheral with the highest priority. analog input functions, such as comparator inputs, are not shown in the priority lists. these inputs are active when the peripheral is enabled and the input multiplexer for the pin is selected. the analog mode, set with the ansela register, disables the digital input buffer thereby preventing excessive input current when the analog input voltage is between logic states. digital output functions may control the pin when it is in analog mode with the priority shown in table 5-1 . note: the ansel register must be initialized to configure an analog channel as a digital input. pins configured as analog inputs will read ? 0 ? and cannot generate an interrupt. table 5-1: porta output priority pin name function priority (1) ra0 icspdat refout dacout cog1out1 (2) ra0 ra1 ra1 ra2 cog1out0 (2) c1out c2out ccp1 ra2 ra3 none ra4 clkout cog1out1 (3) ra4 ra5 cog1out0 (3) ra5 note 1: priority listed from highest to lowest. 2: default function pin (see apfcon register). 3: alternate function pin (see apfcon register).
pic12f752/hv752 ds41576b-page 48 preliminary ? 2011 microchip technology inc. 5.4 porta control registers register 5-2: porta: porta register u-0 u-0 r/w-x/u r/w-x/u r-x/x r/w-x/u r/w-x/u r/w-x/u ? ? ra5 ra4 ra3 ra2 ra1 ra0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = val ue at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ra<5:0> : porta i/o value bits (1) 1 = port pin is > v ih 0 = port pin is < v il note 1: writes to porta are actually written to corresponding lata r egister. reads from porta register is return of actual i/o pin values. register 5-3: trisa: porta tri-state register u-0 u-0 r/w-1/1 r/w-1/1 r-1/1 r/w-1/1 r/w-1/1 r/w-1/1 ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = val ue at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented: read as ? 0 ? bit 5-0 trisa<5:0>: porta tri-state control bits (1) 1 = porta pin configured as an input (tri-stated) 0 = porta pin configured as an output note 1: trisa3 always reads ? 1 ?. register 5-4: lata: porta data latch register u-0 u-0 r/w-x/u r/w-x/u u-0 r/w-x/u r/w-x/u r/w-x/u ? ?lata5lata4 ? lata2 lata1 lata0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = val ue at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented: read as ? 0 ? bit 5-4 lata<5:4> : porta output latch value bits (1) bit 3 unimplemented: read as ? 0 ? bit 2-0 lata<2:0> : porta output latch value bits (1) note 1: writes to porta are actually written to corresponding lata r egister. reads from porta register is return of actual i/o pin values.
? 2011 microchip technology inc. preliminary ds41576b-page 49 pic12f752/hv752 5.5 additional pin functions every porta pin on the pic12f752 has an interrupt- on-change option and a weak pull-up option. the next three sections describe these functions. 5.5.1 ansela register the ansela register ( register 5-5 ) is used to configure the input mode of an i/o pin to analog. setting the appropriate ansela bit high will cause all digital reads on the pin to be read as ? 0 ? and allow analog functions on the pin to operate correctly. the state of the ansela bits has no effect on digital output functions. a pin with tris clear and ansel set will still operate as a digital output, but the input mode will be analog. this can cause unexpected behavior when executing read-modify-write instructions on the affected port. 5.5.2 weak pull-ups each of the porta pins, except ra3, has an individually configurable internal weak pull-up. control bits wpux enable or disable each pull-up. refer to register 5-6 . each weak pull-up is automatically turned off when the port pin is configured as an output. the pull-ups are disabled on a power-on reset by the rapu bit of the option_reg register). a weak pull- up is automatically enabled for ra3 when configured as mclr and disabled when ra3 is an i/o. there is no software control of the mclr pull-up. 5.5.3 interrupt-on-change each porta pin is individually configurable as an interrupt-on-change pin. control bits ioca enable or disable the interrupt function for each pin. refer to register 5-8 . the interrupt-on-change is disabled on a power-on reset. for enabled interrupt-on-change pins, the values are compared with the old value latched on the last read of porta. the ?mismatch? outputs of the last read are or?d together to set the porta change interrupt flag bit (iocif) in the intcon register ( register 2-3 ). this interrupt can wake the device from sleep. the user, in the interrupt service routine, clears the interrupt by: a) any read of porta and clear flag bit iocif. this will end the mismatch condition; or b) any write of porta and clear flag bit iocif will end the mismatch condition; a mismatch condition will continue to set flag bit iocif. reading porta will end the mismatch condition and allow flag bit iocif to be cleared. the latch holding the last read value is not affected by a mclr nor bor reset. after these resets, the iocif flag will continue to be set if a mismatch is present. 5.5.4 slew rate control two of the porta pins, ra0 and ra2, are equipped with high current driver circuitry. the slrcona register provides reduced slew rate control to mitigate possible emi radiation from these pins. note: the ansela bits default to the analog mode after reset. to use any pins as digital general purpose or peripheral inputs, the corresponding ansel bits must be initialized to ? 0 ? by user software. note: if a change on the i/o pin should occur when any porta operation is being executed, then the iocif interrupt flag may not get set.
pic12f752/hv752 ds41576b-page 50 preliminary ? 2011 microchip technology inc. register 5-5: ansela: porta analog select register u-0 u-0 r/w-1 r/w-1 u-0 r/w-1 r/w-1 r/w-1 ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 unimplemented : read as ? 0 ? bit 5-4 ansa<5:4>: analog select between analog or digital function on pin ra<5:4> bits 1 = analog input. pin is assigned as analog input (1) . 0 = digital i/o. pin is assigned to port or special function. bit 3 unimplemented : read as ? 0 ? bit 2-0 ansa<2:0> analog select between analog or digital function on pin ra<2:0> bits 1 = analog input. pin is assigned as analog input. (1) 0 = digital i/o. pin is assigned to port or special function. note 1: setting a pin to an analog input automatically disables t he digital input circuitry, weak pull-ups, and interrupt-on- change if available. the corresponding tris bit must be set to input mode in order to allow external control of the voltage on the pin. register 5-6: wpua: weak pull-up porta register u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? wpu5 wpu4 wpu3 wpu2 wpu1 wpu0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 unimplemented : read as ? 0 ? bit 5-0 wpu<5:0>: weak pull-up control bits 1 = pull-up enabled 0 = pull-up disabled note 1: global rapu must be enabled for individual pull-ups to be enabled. 2: the weak pull-up device is automatically disabled if the pin is in output mode (trisa = 0 ). 3: the ra3 pull-up is enabled when configured as mclr in the configuration word, otherwise it is disabled as an input and reads as ? 0 ?.
? 2011 microchip technology inc. preliminary ds41576b-page 51 pic12f752/hv752 register 5-7: slrcona: sl ew rate control register u-0 u-0 u-0 u-0 u-0 r/w-0 u-0 r/w-0 ? ? ? ? ?slra2 ?slra0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-3 unimplemented : read as ? 0 ? bit 2 slra2: slew rate control bit 1 = pin voltage slews at limited rate 0 = pin voltage slews at maximum rate bit 1 unimplemented : read as ? 0 ? bit 0 slra0: slew rate control bit 1 = pin voltage slews at limited rate 0 = pin voltage slews at maximum rate note 1: global rapu must be enabled for individual pull-ups to be enabled. 2: the weak pull-up device is automatically disabled if the pin is in output mode (trisa = 0 ). 3: the ra3 pull-up is enabled when configured as mclr in the configuration word, otherwise it is disabled as an input and reads as ? 0 ?.
pic12f752/hv752 ds41576b-page 52 preliminary ? 2011 microchip technology inc. register 5-8: iocap: interrupt-on- change positive edge register u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? iocap5 iocap4 iocap3 iocap2 iocap1 iocap0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = val ue at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented : read as ? 0 ? bit 5-0 iocap<5:0>: interrupt-on-change positive edge enable bits 1 = interrupt-on-change enabled on the pin for a positive goi ng edge. associated status bit and interrupt flag will be set upon detecting an edge. 0 = interrupt-on-change disabled for the associated pin. register 5-9: iocan: interrupt-on-change negative edge register u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? iocan5 iocan4 iocan3 iocan2 iocan1 iocan0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = val ue at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented : read as ? 0 ? bit 5-0 iocan<5:0>: interrupt-on-change negative edge enable bits 1 = interrupt-on-change enabled on the pin for a negative goi ng edge. associated status bit and interrupt flag will be set upon detecting an edge. 0 = interrupt-on-change disabled for the associated pin. register 5-10: iocaf: interrupt-on-change flag register u-0 u-0 r/w/hs-0/0 r/w/hs-0/0 r/w/hs-0/0 r/w/hs-0/0 r/w/hs-0/0 r/w/hs-0/0 ? ? iocaf5 iocaf4 iocaf3 iocaf2 iocaf1 iocaf0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = val ue at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared hs - bit is set in hardware bit 7-6 unimplemented : read as ? 0 ? bit 5-0 iocaf<5:0>: interrupt-on-change flag bits 1 = an enabled change was detected on the associated pin. set when iocapx = 1 and a rising edge was detected on rbx, or when iocanx = 1 and a falling edge was detected on rax. 0 = no change was detected, or the user cleared the detected change.
? 2011 microchip technology inc. preliminary ds41576b-page 53 pic12f752/hv752 table 5-2: summary of regist ers associated with porta name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page adcon0 adfm vcfg chs<3:0> go/done adon 106 adcon1 ? adcs<2:0> ? ? ? ? 107 ansela ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 50 apfcon ? ? ?t1gsel ? cog1fsel cog1o1sel cog1o0sel 46 cm1con0 c1on c1out c1oe c1pol c1zlf c1sp c1hys c1sync 127 cm2con0 c2on c2out c2oe c2pol c2zlf c2sp c2hys c2sync 127 cm1con1 c1intp c1intn c1pch<1:0> ? ? ? c1nch0 128 cm2con1 c2ntp c2intn c2pch<1:0> ? ? ? c2nch0 128 daccon0 dacen dacrng dacoe ? ? dacpss0 ? ? 118 iocaf ? ? iocaf5 iocaf4 iocaf3 iocaf2 iocaf1 iocaf0 52 iocan ? ? iocan5 iocan4 iocan3 iocan2 iocan1 iocan0 52 iocap ? ? iocap5 iocap4 iocap3 iocap2 iocap1 iocap0 52 lata ? ?lata5lata4 ? lata2 lata1 lata0 48 option_reg rapu intedg t0cs t0se psa ps<2:0> 19 porta ? ? ra5 ra4 ra3 ra2 ra1 ra0 48 slrcona ? ? ? ? ?slra2 ?slra0 51 trisa ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 48 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ? 0 ?. shaded cells are not used by porta. note 1: trisa3 always reads ? 1 ?.
pic12f752/hv752 ds41576b-page 54 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 55 pic12f752/hv752 6.0 timer0 module the timer0 module is an 8-bit timer/counter with the following features: ? 8-bit timer/counter register (tmr0) ? 8-bit prescaler (shared with watchdog timer) ? programmable internal or external clock source ? programmable external clock edge selection ? interrupt on overflow figure 6-1 is a block diagram of the timer0 module. 6.1 timer0 operation when used as a timer, the timer0 module can be used as either an 8-bit timer or an 8-bit counter. 6.1.1 8-bit timer mode when used as a timer, the timer0 module will increment every instruction cycle (without prescaler). timer mode is selected by clearing the t0cs bit of the option register to ? 0 ?. when tmr0 is written, the increment is inhibited for two instruction cycles immediately following the write. 6.1.2 8-bit counter mode when used as a counter, the timer0 module will increment on every rising or falling edge of the t0cki pin. the incrementing edge is determined by the t0se bit of the option_reg register. counter mode is selected by setting the t0cs bit of the option register to ? 1 ?. figure 6-1: timer0 with share d prescale block diagram note: the value written to the tmr0 register can be adjusted, in order to account for the two instruction cycle delay when tmr0 is written. t0cki t0se pin tmr0 watchdog timer wdt time-out ps<2:0> data bus set flag bit t0if on overflow t0cs note 1: t0se, t0cs, psa, ps<2:0> are bits in the option_reg register. 2: wdte bit is in the configuration word register. 0 1 0 1 0 1 8 8 8-bit prescaler 0 1 f osc /4 psa psa psa sync 2 t cy shared prescale wdte lfintosc ( figure 4-1 ) ?? 2 psa
pic12f752/hv752 ds41576b-page 56 preliminary ? 2011 microchip technology inc. 6.1.3 software programmable prescaler a single software programmable prescaler is available for use with either timer0 or the watchdog timer (wdt), but not both simultaneously. the prescaler assignment is controlled by the psa bit of the option register. to assign the prescaler to timer0, the psa bit must be cleared to a ? 0 ?. there are 8 prescaler options for the timer0 module ranging from 1:2 to 1:256. the prescale values are selectable via the ps<2:0> bits of the option register. in order to have a 1:1 prescaler value for the timer0 module, the prescaler must be assigned to the wdt module. the prescaler is not readable or writable. when assigned to the timer0 module, all instructions writing to the tmr0 register will clear the prescaler. when the prescaler is assigned to wdt, (psa = 1 ), a clrwdt instruction will clear the prescaler along with the wdt. 6.1.3.1 switching prescaler between timer0 and wdt modules as a result of having the prescaler assigned to either timer0 or the wdt, it is possible to generate an unintended device reset when switching prescaler values. when changing the prescaler assignment from timer0 to the wdt module, the instruction sequence shown in example 6-1 , must be executed. example 6-1: changing prescaler (timer0 ? wdt) when changing the prescaler assignment from the wdt to the timer0 module, the following instruction sequence must be executed (see example 6-2 ). example 6-2: changing prescaler (wdt ? timer0) 6.1.4 timer0 interrupt timer0 will generate an interrupt when the tmr0 register overflows from ffh to 00h. the t0if interrupt flag bit of the intcon register is set every time the tmr0 register overflows, regardless of whether or not the timer0 interrupt is enabled. the t0if bit must be cleared in software. the timer0 interrupt enable is the t0ie bit of the intcon register. 6.1.5 using timer0 with an external clock when timer0 is in counter mode, the synchronization of the t0cki input and the timer0 register is accomplished by sampling the prescaler output on the q2 and q4 cycles of the internal phase clocks. therefore, the high and low periods of the external clock source must meet the timing requirements as shown in section 20.0 ?electrical specifications? . banksel tmr0 ; clrwdt ;clear wdt clrf tmr0 ;clear tmr0 and ;prescaler banksel option_reg ; bsf option_reg,psa ;select wdt clrwdt ; ; movlw b?11111000? ;mask prescaler andwf option_reg,w ;bits iorlw b?00000101? ;set wdt prescaler movwf option_reg ;to 1:32 note: the timer0 interrupt cannot wake the pro- cessor from sleep since the timer is fro- zen during sleep. clrwdt ;clear wdt and ;prescaler banksel option_reg ; movlw b?11110000? ;mask tmr0 select and andwf option_reg,w ;prescaler bits iorlw b?00000011? ;set prescale to 1:16 movwf option_reg ;
? 2011 microchip technology inc. preliminary ds41576b-page 57 pic12f752/hv752 6.2 option and timer0 control register table 6-1: summary of registers associated with timer0 register 6-1: option_reg: option register r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 rapu intedg t0cs t0se psa ps<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 rapu : porta pull-up enable bit 1 = porta pull-ups are disabled 0 = porta pull-ups are enabled by individual port latch values in wpu register bit 6 intedg: interrupt edge select bit 1 = interrupt on rising edge of int pin 0 = interrupt on falling edge of int pin bit 5 t0cs: tmr0 clock source select bit 1 = transition on t0cki pin 0 = internal instruction cycle clock (f osc /4) bit 4 t0se: tmr0 source edge select bit 1 = increment on high-to-low transition on t0cki pin 0 = increment on low-to-high transition on t0cki pin bit 3 psa: prescaler assignment bit 1 = prescaler is assigned to the wdt 0 = prescaler is assigned to the timer0 module bit 2-0 ps<2:0>: prescaler rate select bits 000 001 010 011 100 101 110 111 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 1 : 1 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 bit value tmr0 rate wdt rate name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page tmr0 holding register for the 8-bit timer0 register 55 * intcon gie peie t0ie inte iocie t0if intf iocif 20 option_reg rapu intedg t0cs t0se psa ps<2:0> 57 trisa ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 48 legend: ? = unimplemented locations, read as ? 0 ?, u = unchanged, x = unknown. shaded cells are not used by the timer0 module. * page provides register information. note 1: trisa3 always reads ? 1 ?.
pic12f752/hv752 ds41576b-page 58 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 59 pic12f752/hv752 7.0 timer1 module with gate control the timer1 module is a 16-bit timer/counter with the following features: ? 16-bit timer/counter register pair (tmr1h:tmr1l) ? selectable internal or external clock sources ? 2-bit prescaler ? synchronous or asynchronous operation ? multiple timer1 gate (count enable) sources ? interrupt on overflow ? wake-up on overflow (external clock, asynchronous mode only) ? time base for the capture/compare function ? special event trigger (with ccp) ? selectable gate source polarity ? gate toggle mode ? gate single-pulse mode ? gate value status ? gate event interrupt figure 7-1 is a block diagram of the timer1 module. figure 7-1: timer1 block diagram tmr1h tmr1l t1ckps<1:0> prescaler 1, 2, 4, 8 0 1 synchronized clock input 2 set flag bit tmr1if on overflow tmr1 (2) tmr1on note 1: st buffer is high speed type when using t1cki. 2: timer1 register increments on rising edge. 3: synchronize does not operate while in sleep. t1g f osc /4 internal clock t1cki tmr1cs<1:0> (1) synchronize (3) det sleep input tmr1ge 0 1 00 01 10 11 from timer0 syncc1out t1gpol d q ck q 0 1 t1gval single pulse acq. control t1gspm t1ggo/done t1gss<1:0> 10 11 00 01 f osc internal clock temperature sense syncc2out overflow r d en q q1 rd t1gcon data bus det interrupt tmr1gif t1clk f osc /2 internal clock d en q t1g_in tmr1on t1gtm oscillator t1sync tmr1cs1 r ccp special event trigger
pic12f752/hv752 ds41576b-page 60 preliminary ? 2011 microchip technology inc. 7.1 timer1 operation the timer1 module is a 16-bit incrementing counter which is accessed through the tmr1h:tmr1l register pair. writes to tmr1h or tmr1l directly update the counter. when used with an internal clock source, the module is a timer and increments on every instruction cycle. when used with an external clock source, the module can be used as either a timer or counter and increments on every selected edge of the external source. timer1 is enabled by configuring the tmr1on and tmr1ge bits in the t1con and t1gcon registers, respectively. ta b l e 7 - 1 displays the timer1 enable selections. 7.2 clock source selection the tmr1cs<1:0> bits of the t1con register are used to select the clock source for timer1. tab l e 7 - 2 displays the clock source selections. 7.2.1 internal clock source when the internal clock source is selected, the tmr1h:tmr1l register pair will increment on multiples of f osc or f osc /4 as determined by the timer1 prescaler. 7.2.2 external clock source when the external clock source is selected, the timer1 module may work as a timer or a counter. when enabled to count, timer1 is incremented on the rising edge of the external clock input t1cki. 7.2.3 temperature sense oscillator when the temperature sense oscillator source is selected, the tmr1h:tmr1l register pair will increment on multiples of the temperature sense oscillator as determined by the timer1 prescaler. the temperature sense oscillator operates at 16 khz typical. table 7-1: timer1 enable selections tmr1on tmr1ge timer1 operation 00 off 01 off 10 always on 11 count enabled table 7-2: clock source selections tmr1cs<1:0> clock source 11 temperature sense oscillator 10 external clocking on t1cki pin 01 system clock (f osc ) 00 instruction clock (f osc /4) note: in counter mode, a falling edge must be registered by the counter prior to the first incrementing rising edge (see figure 7-2 ) after any one or more of the following conditions: ? timer1 enabled after por reset ? write to tmr1h or tmr1l ? timer1 is disabled ? timer1 is disabled (tmr1on = 0 ) when t1cki is high then timer1 is enabled (tmr1on= 1 ) when t1cki is low.
? 2011 microchip technology inc. preliminary ds41576b-page 61 pic12f752/hv752 7.3 timer1 prescaler timer1 has four prescaler options allowing 1, 2, 4 or 8 divisions of the clock input. the t1ckps bits of the t1con register control the prescale counter. the prescale counter is not directly readable or writable; however, the prescaler counter is cleared upon a write to tmr1h or tmr1l. 7.4 timer1 operation in asynchronous counter mode if control bit t1sync of the t1con register is set, the external clock input is not synchronized. the timer increments asynchronously to the internal phase clocks. if external clock source is selected then the timer will continue to run during sleep and can generate an interrupt on overflow, which will wake-up the processor. however, special precautions in software are needed to read/write the timer (see section 7.4.1 ?reading and writing timer1 in asynchronous counter mode? ). 7.4.1 reading and writing timer1 in asynchronous counter mode reading tmr1h or tmr1l while the timer is running from an external asynchronous clock will ensure a valid read (taken care of in hardware). however, the user should keep in mind that reading the 16-bit timer in two 8-bit values itself, poses certain problems, since the timer may overflow between the reads. for writes, it is recommended that the user simply stop the timer and write the desired values. a write contention may occur by writing to the timer registers, while the register is incrementing. this may produce an unpredictable value in the tmr1h:tmr1l register pair. 7.5 timer1 gate timer1 can be configured to count freely or the count can be enabled and disabled using timer1 gate circuitry. this is also referred to as timer1 gate count enable. timer1 gate can also be driven by multiple selectable sources. 7.5.1 timer1 gate count enable the timer1 gate is enabled by setting the tmr1ge bit of the t1gcon register. the polarity of the timer1 gate is configured using the t1gpol bit of the t1gcon register. when timer1 gate (t1g) input is active, timer1 will increment on the rising edge of the timer1 clock source. when timer1 gate input is inactive, no incrementing will occur and timer1 will hold the current count. see figure 7-3 for timing details. 7.5.2 timer1 gate source selection the timer1 gate source can be selected from one of four different sources. source selection is controlled by the t1gss bits of the t1gcon register. the polarity for each available source is also selectable. polarity selection is controlled by the t1gpol bit of the t1gcon register. note: when switching from synchronous to asynchronous operation, it is possible to skip an increment. when switching from asynchronous to synchronous operation, it is possible to produce an additional increment. table 7-3: timer1 gate enable selections t1clk t1gpol t1g timer1 operation ? 00 counts ? 01 holds count ? 10 holds count ? 11 counts table 7-4: timer1 gate sources t1gss timer1 gate source 11 syncc2out 10 syncc1out 01 overflow of timer0 (tmr0 increments from ffh to 00h) 00 timer1 gate pin
pic12f752/hv752 ds41576b-page 62 preliminary ? 2011 microchip technology inc. 7.5.2.1 t1g pin gate operation the t1g pin is one source for timer1 gate control. it can be used to supply an external source to the timer1 gate circuitry. 7.5.2.2 timer0 overflow gate operation when timer0 increments from ffh to 00h, a low-to- high pulse will automatically be generated and internally supplied to the timer1 gate circuitry. 7.5.2.3 c1out/c2out gate operation the outputs from the comparator c1 and c2 modules can be used as gate sources for the timer1 module. 7.5.3 timer1 gate toggle mode when timer1 gate toggle mode is enabled, it is possible to measure the full-cycle length of a timer1 gate signal, as opposed to the duration of a single level pulse. the timer1 gate source is routed through a flip-flop that changes state on every incrementing edge of the sig- nal. see figure 7-4 for timing details. timer1 gate toggle mode is enabled by setting the t1gtm bit of the t1gcon register. when the t1gtm bit is cleared, the flip-flop is cleared and held clear. this is necessary in order to control which edge is measured. 7.5.4 timer1 gate single-pulse mode when timer1 gate single-pulse mode is enabled, it is possible to capture a single pulse gate event. timer1 gate single-pulse mode is first enabled by setting the t1gspm bit in the t1gcon register. next, the t1ggo/done bit in the t1gcon register must be set. the timer1 will be fully enabled on the next incrementing edge. on the next trailing edge of the pulse, the t1ggo/done bit will automatically be cleared. no other gate events will be allowed to increment timer1 until the t1ggo/done bit is once again set in software. clearing the t1gspm bit of the t1gcon register will also clear the t1ggo/done bit. see figure 7-5 for timing details. enabling the toggle mode and the single-pulse mode simultaneously will permit both sections to work together. this allows the cycle times on the timer1 gate source to be measured. see figure 7-6 for timing details. 7.5.5 timer1 gate value status when timer1 gate value status is utilized, it is possible to read the most current level of the gate control value. the value is stored in the t1gval bit in the t1gcon register. the t1gval bit is valid even when the timer1 gate is not enabled (tmr1ge bit is cleared). 7.5.6 timer1 gate event interrupt when timer1 gate event interrupt is enabled, it is possible to generate an interrupt upon the completion of a gate event. when the falling edge of t1gval occurs, the tmr1gif flag bit in the pir1 register will be set. if the tmr1gie bit in the pie1 register is set, then an interrupt will be recognized. the tmr1gif flag bit operates even when the timer1 gate is not enabled (tmr1ge bit is cleared). note: enabling toggle mode at the same time as changing the gate polarity may result in indeterminate operation.
? 2011 microchip technology inc. preliminary ds41576b-page 63 pic12f752/hv752 7.6 timer1 interrupt the timer1 register pair (tmr1h:tmr1l) increments to ffffh and rolls over to 0000h. when timer1 rolls over, the timer1 interrupt flag bit of the pir1 register is set. to enable the interrupt on rollover, you must set these bits: ? tmr1on bit of the t1con register ? tmr1ie bit of the pie1 register ? peie bit of the intcon register ? gie bit of the intcon register the interrupt is cleared by clearing the tmr1if bit in the interrupt service routine. 7.7 timer1 operation during sleep timer1 can only operate during sleep when setup in asynchronous counter mode. in this mode, the clock source can be used to increment the counter. to set up the timer to wake the device: ? tmr1on bit of the t1con register must be set ? tmr1ie bit of the pie1 register must be set ? peie bit of the intcon register must be set ? t1sync bit of the t1con register must be set ? tmr1cs bits of the t1con register must be configured ? tmr1ge bit of the t1gcon register must be configured the device will wake-up on an overflow and execute the next instructions. if the gie bit of the intcon register is set, the device will call the interrupt service routine (0004h). 7.8 ccp capture/compare time base the ccp module uses the tmr1h:tmr1l register pair as the time base when operating in capture or compare mode. in capture mode, the value in the tmr1h:tmr1l register pair is copied into the ccpr1h:ccpr1l register pair on a configured event. in compare mode, an event is triggered when the value ccpr1h:ccpr1l register pair matches the value in the tmr1h:tmr1l register pair. this event can be a special event trigger. for more information, see section 10.0 ?capture/ compare/pwm modules? . 7.9 ccp special event trigger when the ccp is configured to trigger a special event, the trigger will clear the tmr1h:tmr1l register pair. this special event does not cause a timer1 interrupt. the ccp module may still be configured to generate a ccp interrupt. in this mode of operation, the ccpr1h:ccpr1l register pair becomes the period register for timer1. timer1 should be synchronized to the f osc /4 to utilize the special event trigger. asynchronous operation of timer1 can cause a special event trigger to be missed. in the event that a write to tmr1h or tmr1l coincides with a special event trigger from the ccp, the write will take precedence. for more information, see section 12.2.5 ?special event trigger? . figure 7-2: timer1 incrementing edge note: the tmr1h:tmr1l register pair and the tmr1if bit should be cleared before enabling interrupts. t1cki t1cki tmr1 enabled note 1: arrows indicate counter increments. 2: in counter mode, a falling edge must be registered by the count er prior to the first incrementing rising edge of the clock.
pic12f752/hv752 ds41576b-page 64 preliminary ? 2011 microchip technology inc. figure 7-3: timer1 gate count enable mode figure 7-4: timer1 gate toggle mode tmr1ge t1gpol t1g_in t1cki t1gval timer1 n n + 1 n + 2 n + 3 n + 4 tmr1ge t1gpol t1gtm t1g_in t1cki t1gval timer1 n n + 1 n + 2 n + 3 n + 4 n + 5 n + 6 n + 7 n + 8
? 2011 microchip technology inc. preliminary ds41576b-page 65 pic12f752/hv752 figure 7-5: timer1 gate single-pulse mode tmr1ge t1gpol t1g_in t1cki t1gval timer1 n n + 1 n + 2 t1gspm t1ggo/ done set by software cleared by hardware on falling edge of t1gval set by hardware on falling edge of t1gval cleared by software cleared by software tmr1gif counting enabled on rising edge of t1g
pic12f752/hv752 ds41576b-page 66 preliminary ? 2011 microchip technology inc. figure 7-6: timer1 gate single-pulse and toggle combined mode tmr1ge t1gpol t1g_in t1cki t1gval timer1 nn + 1 n + 2 t1gspm t1ggo/ done set by software cleared by hardware on falling edge of t1gval set by hardware on falling edge of t1gval cleared by software cleared by software tmr1gif t1gtm counting enabled on rising edge of t1g n + 4 n + 3
? 2011 microchip technology inc. preliminary ds41576b-page 67 pic12f752/hv752 7.10 timer1 control registers register 7-1: t1con: ti mer1 control register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 tmr1cs<1:0> t1ckps<1:0> reserved t1sync ?tmr1on bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 tmr1cs<1:0>: timer1 clock source select bits 11 = temperature sense oscillator 10 = external clock from t1cki pin (on the rising edge) 01 = timer1 clock source is system clock (f osc ) 00 = timer1 clock source is instruction clock (f osc /4) bit 5-4 t1ckps<1:0>: timer1 input clock prescale select bits 11 = 1:8 prescale value 10 = 1:4 prescale value 01 = 1:2 prescale value 00 = 1:1 prescale value bit 3 reserved : do not use. bit 2 t 1sync : timer1 external clock input synchronization control bit tmr1cs<1:0> = 1x 1 = do not synchronize external clock input 0 = synchronize external clock input with system clock (f osc ) tmr1cs<1:0> = 0x this bit is ignored. timer1 uses the internal clock when tmr1cs<1:0> = 1x . bit 1 unimplemented: read as ? 0 ? bit 0 tmr1on: timer1 on bit 1 = enables timer1 0 = stops timer1 clears timer1 gate flip-flop
pic12f752/hv752 ds41576b-page 68 preliminary ? 2011 microchip technology inc. register 7-2: t1gcon: timer1 gate control register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r-x r/w-0 r/w-0 tmr1ge t1gpol t1gtm t1gspm t1ggo/ done t1gval t1gss<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 tmr1ge: timer1 gate enable bit if tmr1on = 0 : this bit is ignored if tmr1on = 1 : 1 = timer1 counting is controlled by the timer1 gate function 0 = timer1 counts regardless of timer1 gate function bit 6 t1gpol: timer1 gate polarity bit 1 = timer1 gate is active-high (timer1 counts when gate is high) 0 = timer1 gate is active-low (timer1 counts when gate is low) bit 5 t1gtm: timer1 gate toggle mode bit 1 = timer1 gate toggle mode is enabled. 0 = timer1 gate toggle mode is disabled and toggle flip-flop is cleared timer1 gate flip-flop toggles on every rising edge. bit 4 t1gspm: timer1 gate single pulse mode bit 1 = timer1 gate single-pulse mode is enabled and is controlling timer1 gate 0 = timer1 gate single-pulse mode is disabled bit 3 t1ggo/done : timer1 gate single-pulse acquisition status bit 1 = timer1 gate single-pulse acquisition is ready, waiting for an edge 0 = timer1 gate single-pulse acquisition has completed or has not been started this bit is automatically cleared when t1gspm is cleared. bit 2 t1gval: timer1 gate current state bit indicates the current state of the timer1 gate that could be provided to tmr1h:tmr1l. unaffected by timer1 gate enable (tmr1ge). bit 1-0 t1gss<1:0>: timer1 gate source select bits 11 = syncc2out 10 = syncc1out 01 = timer0 overflow output 00 = timer1 gate pin
? 2011 microchip technology inc. preliminary ds41576b-page 69 pic12f752/hv752 table 7-5: summary of registers associated with timer1 name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ansela ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 50 apfcon ? ? ? t1gsel ? cog1sel cog1o1sel cog1o0sel 46 ccp1con ? ? dc1b<1:0> ccp1m<3:0> 83 intcon gie peie t0ie inte iocie t0if intf iocif 20 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 21 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 23 porta ? ? ra5 ra4 ra3 ra2 ra1 ra0 48 tmr1h holding register for the most significant byte of the 16-bit tmr1 register 59 * tmr1l holding register for the least significant byte of the 16-bit tmr1 register 59 * trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 48 t1con tmr1cs<1:0> t1ckps<1:0> reserved t1sync ? tmr1on 67 t1gcon tmr1ge t1gpol t1gtm t1gspm t1ggo/ done t1gval t1gss<1:0> 68 legend: x = unknown, u = unchanged, - = unimplemented, read as ? 0 ?. shaded cells are not used by the timer1 module. * page provides register information.
pic12f752/hv752 ds41576b-page 70 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 71 pic12f752/hv752 8.0 timer2 module the timer2 module is an 8-bit timer with the following features: ? 8-bit timer register (tmr2) ? 8-bit period register (pr2) ? interrupt on tmr2 match with pr2 ? software programmable prescaler (1:1, 1:4, 1:16) ? software programmable postscaler (1:1 to 1:16) see figure 8-1 for a block diagram of timer2. 8.1 timer2 operation the clock input to the timer2 module is the system instruction clock (f osc /4). the clock is fed into the timer2 prescaler, which has prescale options of 1:1, 1:4 or 1:16. the output of the prescaler is then used to increment the tmr2 register. the values of tmr2 and pr2 are constantly compared to determine when they match. tmr2 will increment from 00h until it matches the value in pr2. when a match occurs, two things happen: ? tmr2 is reset to 00h on the next increment cycle. ? the timer2 postscaler is incremented the match output of the timer2/pr2 comparator is then fed into the timer2 postscaler. the postscaler has postscale options of 1:1 to 1:16 inclusive. the output of the timer2 postscaler is used to set the tmr2if interrupt flag bit in the pir1 register. the tmr2 and pr2 registers are both fully readable and writable. on any reset, the tmr2 register is set to 00h and the pr2 register is set to ffh. timer2 is turned on by setting the tmr2on bit in the t2con register to a ? 1 ?. timer2 is turned off by clearing the tmr2on bit to a ? 0 ?. the timer2 prescaler is controlled by the t2ckps bits in the t2con register. the timer2 postscaler is controlled by the toutps bits in the t2con register. the prescaler and postscaler counters are cleared when: ? a write to tmr2 occurs. ? a write to t2con occurs. ? any device reset occurs (power-on reset, mclr reset, watchdog timer reset, or brown-out reset). figure 8-1: timer2 block diagram note: tmr2 is not cleared when t2con is written. comparator tmr2 output sets flag tmr2 reset postscaler prescaler pr2 2 f osc /4 1:1 to 1:16 1:1, 1:4, 1:16 eq 4 bit tmr2if toutps<3:0> t2ckps<1:0>
pic12f752/hv752 ds41576b-page 72 preliminary ? 2011 microchip technology inc. 8.2 timer2 control registers table 8-1: summary of registers associated with timer2 register 8-1: t2con: ti mer 2 control register u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? toutps<3:0> tmr2on t2ckps<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 unimplemented: read as ? 0 ? bit 6-3 toutps<3:0>: timer2 output postscaler select bits 0000 = 1:1 postscaler 0001 = 1:2 postscaler 0010 = 1:3 postscaler 0011 = 1:4 postscaler 0100 = 1:5 postscaler 0101 = 1:6 postscaler 0110 = 1:7 postscaler 0111 = 1:8 postscaler 1000 = 1:9 postscaler 1001 = 1:10 postscaler 1010 = 1:11 postscaler 1011 = 1:12 postscaler 1100 = 1:13 postscaler 1101 = 1:14 postscaler 1110 = 1:15 postscaler 1111 = 1:16 postscaler bit 2 tmr2on: timer2 on bit 1 = timer2 is on 0 = timer2 is off bit 1-0 t2ckps<1:0>: timer2 clock prescale select bits 00 = prescaler is 1 01 = prescaler is 4 1x = prescaler is 16 namebit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0 register on page intcon gie peie t0ie inte iocie t0if intf iocif 20 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 21 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 23 pr2 timer2 module period register 71 * tmr2 holding register for the 8-bit tmr2 register 71 * t2con ? toutps<3:0> tmr2on t2ckps<1:0> 72 legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ?. shaded cells are not used for timer2 module. * page provides register information.
? 2011 microchip technology inc. preliminary ds41576b-page 73 pic12f752/hv752 9.0 hardware limit timer (hlt) module the hardware limit timer (hlt) module is a version of the timer2-type modules. in addition to all the timer2- type features, the hlt can be reset on rising and falling events from selected peripheral outputs. the hlt primary purpose is to act as a timed hardware limit to be used in conjunction with asynchronous analog feedback applications. the external reset source synchronizes the hltmr1 to an analog application. in normal operation, the external reset source from the analog application should occur before the hltmr1 matches the hltpr1. this resets hltmr1 for the next period and prevents the hltimer1 output from going active. when the external reset source fails to generate a signal within the expected time, (allowing the hltmr1 to match the hltpr1), then the hltimer1 output becomes active. the hlt module incorporates the following features: ? 8-bit read-write timer register (hltmr1) ? 8-bit read-write period register (hltpr1) ? software programmable prescaler: -1:1 -1:4 -1:16 ? software programmable postscaler - 1:1 to 1:16, inclusive ? interrupt on hltmr1 match with hltpr1 ? 8 selectable timer reset inputs (5 reserved) ? reset on rising and falling event refer to figure 9-1 for a block diagram of the hlt. figure 9-1: hltmr1 block diagram comparator hltimer1 output sets flag bit hltmr1if hltmr1 reset postscaler prescaler hltpr1 f osc /4 1:1 to 1:16 1:1, 1:4, 1:16 eq h1outps<3:0> h1ckps<1:0> detect h1feren h1reren h1ers<2:0> detect ccp1 out c1out c2out ? 0 ? ? 0 ? cog1out1 cog1out0 cog1flt 000 111 h1on (to cog module) 3 2 4
pic12f752/hv752 ds41576b-page 74 preliminary ? 2011 microchip technology inc. 9.1 hlt operation the clock input to the hlt module is the system instruction clock (f osc /4). hltmr1 increments on each rising clock edge. a 4-bit counter/prescaler on the clock input provides the following prescale options: ? direct input ?divide-by-4 ?divide-by-16 the prescale options are selected by the prescaler control bits, h1ckps<1:0> of the hlt1con0 register. the value of hltmr1 is compared to that of the period register, hltpr1, on each clock cycle. when the two values match,then the comparator generates a match signal as the hltimer1 output. this signal also resets the value of hltmr1 to 00h on the next clock rising edge and drives the output counter/postscaler (see section 9.2 ?hlt interrupt? ). the hltmr1 and hltpr1 registers are both directly readable and writable. the hltmr1 register is cleared on any device reset, whereas the hltpr1 register initializes to ffh. both the prescaler and postscaler counters are cleared on any of the following events: ? a write to the hltmr1 register ? a write to the hlt1con0 register ? power-on reset (por) ? brown-out reset (bor) ?mclr reset ? watchdog timer (wdt) reset ? stack overflow reset ? stack underflow reset ? reset instruction 9.2 hlt interrupt the hlt can also generate an optional device interrupt. the hltmr1 output signal (hltmr1-to-hltpr1 match) provides the input for the 4-bit counter/ postscaler. the overflow output of the postscaler sets the hltmr1if bit of the pir1 register. the interrupt is enabled by setting the hltmr1 match interrupt enable bit, hltmr1ie of the pie1 register. a range of 16 postscale options (from 1:1 through 1:16 inclusive) can be selected with the postscaler control bits, h1outps<3:0>, of the hlt1con0 register. 9.3 peripheral resets resets driven from the selected peripheral output pre- vents the hltmr1 from matching the hltpr1 register and generating an output. in this manner, the hlt can be used as a hardware time limit to other peripherals. in this device, the primary purpose of the hlt is to limit the cog pwm duty cycle. normally, the cog opera- tion uses analog feedback to determine the pwm duty cycle. the same feedback signal is used as an hlt reset input. the hltpr1 register is set to occur at the maximum allowed duty cycle. if the analog feedback to the cog exceeds the maximum time, then an hltmr1-to-hltpr1 match will occur and generate the output needed to limit the cog drive output. the hltmr1 can be reset by one of several selectable peripheral sources. reset inputs include: ? ccp1 output ? comparator 1 output ? comparator 2 output the reset input is selected with the h1ers<2:0> bits of the hlt1con1 register. hltmr1 resets are synchronous with the hlt clock. in other words, hltmr1 is cleared on the rising edge of the hlt clock after the enabled reset event occurs. the reset can be enabled to occur on the rising and falling input event. rising and falling event enables are selected with the respective h1reren and h1feren bits of the hlt1con1 register. external resets do not cause an hltmr1 output event. 9.4 hltimer1 output the unscaled output of hltmr1 is available only to the cog module, where it is used as a selectable limit to the maximum cog period. 9.5 hlt operation during sleep the hlt cannot be operated while the processor is in sleep mode. the contents of the hltmr1 register will remain unchanged while the processor is in sleep mode. note: hltmr1 is not cleared when hlt1con0 is written.
? 2011 microchip technology inc. preliminary ds41576b-page 75 pic12f752/hv752 9.6 hlt control registers register 9-1: hlt1con0: hlt1 control register 0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? h1outps<3:0> h1on h1ckps<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented: read as ? 0 ? bit 6-3 h1outps<3:0>: hardware limit timer 1 output postscaler select bits 0000 = 1:1 postscaler 0001 = 1:2 postscaler 0010 = 1:3 postscaler 0011 = 1:4 postscaler 0100 = 1:5 postscaler 0101 = 1:6 postscaler 0110 = 1:7 postscaler 0111 = 1:8 postscaler 1000 = 1:9 postscaler 1001 = 1:10 postscaler 1010 = 1:11 postscaler 1011 = 1:12 postscaler 1100 = 1:13 postscaler 1101 = 1:14 postscaler 1110 = 1:15 postscaler 1111 = 1:16 postscaler bit 2 h1on: hardware limit timer 1 on bit 1 =timer is on 0 =timer is off bit 1-0 h1ckps<1:0>: hardware limit timer 1 clock prescale select bits 00 =prescaler is 1 01 =prescaler is 4 1x = prescaler is 16
pic12f752/hv752 ds41576b-page 76 preliminary ? 2011 microchip technology inc. table 9-1: summary of registers associated with hlt register 9-2: hlt1con1: hlt1 control register 1 u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? h1ers<2:0> h1feren h1reren bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-5 unimplemented: read as ? 0 ? bit 4-2 h1ers<2:0>: hardware limit timer 1 peripheral reset select bits 000 = ccp1 out 001 =c1out 010 =c2out 011 =cog1flt 100 =cog1out0 101 =cog1out1 110 = reserved - ? 0 ? input 111 = reserved - ? 0 ? input bit 1 h1feren: hardware limit timer 1 falling edge reset enable bit 1 = hltmr1 will reset on the first clock after a falling edge of selected reset source 0 = falling edges of selected source have no effect bit 0 h1reren: hardware limit timer 1 rising edge reset enable bit 1 = hltmr1 will reset on the first clock after a rising edge of selected reset source 0 = rising edges of selected source have no effect name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ccp1con ? ? dc1b<1:0> ccp1m<3:0> 83 cm1con0 c1on c1out c1oe c1pol c1zlf c1sp c1hys c1sync 127 cm1con1 c1intp c1intn c1pch<1:0> ? ? ? c1nch0 128 cm2con0 c2on c2out c2oe c2pol c2zlf c2sp c2hys c2sync 127 cm2con1 c2intp c2intn c2pch<1:0> ? ? ? c2nch0 128 intcon gie peie t0ie inte iocie t0if intf iocif 20 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 21 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 23 hltmr1 holding register for the 8-bit hardware limit timer1 register 73 * hltpr1 hltmr1 module period register 73 * hlt1con0 ? h1outps<3:0> h1on h1ckps<1:0> 75 hlt1con1 ? ? ? h1ers<2:0> h1feren h1reren 76 legend: ? = unimplemented location, read as ? 0 ?. shaded cells do not affect the hlt module operation. * page provides register information.
? 2011 microchip technology inc. preliminary ds41576b-page 77 pic12f752/hv752 10.0 capture/compare/pwm modules the capture/compare/pwm module is a peripheral which allows the user to time and control different events, and to generate pulse-width modulation (pwm) signals. in capture mode, the peripheral allows the timing of the duration of an event. the compare mode allows the user to trigger an external event when a predetermined amount of time has expired. the pwm mode can generate pulse-width modulated signals of varying frequency and duty cycle. 10.1 capture mode capture mode makes use of the 16-bit timer1 resource. when an event occurs on the ccp1 pin, the 16-bit ccpr1h:ccpr1l register pair captures and stores the 16-bit value of the tmr1h:tmr1l register pair, respectively. an event is defined as one of the following and is configured by the ccp1m<3:0> bits of the ccp1con register: ? every falling edge ? every rising edge ? every 4th rising edge ? every 16th rising edge when a capture is made, the interrupt request flag bit ccp1if of the pir2 register is set. the interrupt flag must be cleared in software. if another capture occurs before the value in the ccpr1h, ccpr1l register pair is read, the old captured value is overwritten by the new captured value. figure 10-1 shows a simplified diagram of the capture operation. 10.1.1 ccp1 pin configuration in capture mode, the ccp1 pin should be configured as an input by setting the associated tris control bit. figure 10-1: capture mode operation block diagram 10.1.2 timer1 mode resource timer1 must be running in timer mode or synchronized counter mode for the ccp1 module to use the capture feature. in asynchronous counter mode, the capture operation may not work. see section 7.0 ?timer1 module with gate control? for more information on configuring timer1. 10.1.3 software interrupt mode when the capture mode is changed, a false capture interrupt may be generated. the user should keep the ccp1ie interrupt enable bit of the pie2 register clear to avoid false interrupts. additionally, the user should clear the ccp1if interrupt flag bit of the pir2 register following any change in operating mode. 10.1.4 ccp1 prescaler there are four prescaler settings specified by the ccp1m<3:0> bits of the ccp1con register. whenever the ccp1 module is turned off, or the ccp1 module is not in capture mode, the prescaler counter is cleared. any reset will clear the prescaler counter. switching from one capture prescaler to another does not clear the prescaler and may generate a false interrupt. to avoid this unexpected operation, turn the module off by clearing the ccp1con register before changing the prescaler. example 10-1 demonstrates the code to perform this function. example 10-1: changing between capture prescalers note: if the ccp1 pin is configured as an output, a write to the port can cause a capture condition. ccpr1h ccpr1l tmr1h tmr1l set flag bit ccp1if (pir2 register) capture enable ccp1m<3:0> prescaler ? 1, 4, 16 and edge detect pin ccp1 system clock (f osc ) note: clocking timer1 from the system clock (f osc ) should not be used in capture mode. in order for capture mode to recognize the trigger event on the ccp1 pin, timer1 must be clocked from the instruction clock (f osc /4) or from an external clock source. banksel ccp1con ;set bank bits to point ;to ccp1con clrf ccp1con ;turn ccp1 module off movlw new_capt_ps ;load the w reg with ;the new prescaler ;move value and ccp1 on movwf ccp1con ;load ccp1con with this ;value
pic12f752/hv752 ds41576b-page 78 preliminary ? 2011 microchip technology inc. 10.1.5 capture during sleep capture mode depends upon the timer1 module for proper operation. if the timer1 clock input source is a clock that is not disabled during sleep, timer1 will con- tinue to operate and capture mode will operate during sleep to wake the device. the t1cki is an example of a clock source that will operate during sleep. when the input source to timer1 is disabled during sleep, such as the hfintosc, timer1 will not incre- ment during sleep. when the device wakes from sleep, timer1 will continue from its previous state. table 10-1: summary of registers associated with capture name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ccp1con ? ? dc1b<1:0> ccp1m<3:0> 83 ccpr1l capture/compare/pwm register x low byte (lsb) 77 ccpr1h capture/compare/pwm register x high byte (msb) 77 intcon gie peie t0ie inte iocie t0if intf iocif 20 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 21 pie2 ? ? c2ie c1ie ? cog1ie ? ccp1ie 22 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 23 pir2 ? ? c2if c1if ? cog1if ? ccp1if 24 t1con tmr1cs<1:0> t1ckps<1:0> reserved t1sync ?tmr1on 67 t1gcon tmr1ge t1gpol t1gtm t1gspm t1ggo/ done t1gval t1gss<1:0> 68 tmr1h holding register for the most significant byte of the 16-bit tmr1 register 59 * tmr1l holding register for the least significant byte of the 16-bit tmr1 register 59 * trisa ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 48 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are no t used by capture mode. * page provides register information. note 1: trisa3 always reads ? 1 ?.
? 2011 microchip technology inc. preliminary ds41576b-page 79 pic12f752/hv752 10.2 compare mode compare mode makes use of the 16-bit timer1 resource. the 16-bit value of the ccpr1h:ccpr1l register pair is constantly compared against the 16-bit value of the tmr1h:tmr1l register pair. when a match occurs, one of the following events can occur: ? toggle the ccp1 output ? set the ccp1 output ? clear the ccp1 output ? generate a special event trigger ? generate a software interrupt the action on the pin is based on the value of the ccp1m<3:0> control bits of the ccp1con register. at the same time, the interrupt flag ccp1if bit is set. all compare modes can generate an interrupt. figure 10-2 shows a simplified diagram of the compare operation. figure 10-2: compare mode operation block diagram 10.2.1 ccp1 pin configuration the user must configure the ccp1 pin as an output by clearing the associated tris bit. 10.2.2 timer1 mode resource in compare mode, timer1 must be running in either timer mode or synchronized counter mode. the compare operation may not work in asynchronous counter mode. see section 7.0 ?timer1 module with gate control? for more information on configuring timer1. 10.2.3 software interrupt mode when generate software interrupt mode is chosen (ccp1m<3:0> = 1010 ), the ccp1 module does not assert control of the ccp1 pin (see the ccp1con register). 10.2.4 special event trigger when special event trigger mode is chosen (ccp1m<3:0> = 1011 ), the ccp1 module does the following: ? resets timer1 ? starts an adc conversion if adc is enabled the ccp1 module does not assert control of the ccp1 pin in this mode. the special event trigger output of the ccp1 occurs immediately upon a match between the tmr1h, tmr1l register pair and the ccpr1h, ccpr1l regis- ter pair. the tmr1h, tmr1l register pair is not reset until the next rising edge of the timer1 clock. the spe- cial event trigger output starts an a/d conversion (if the a/d module is enabled). this allows the ccpr1h, ccpr1l register pair to effectively provide a 16-bit pro- grammable period register for timer1. refer to section 12.0 ?analog-to-digital converter (adc) module? for more information. note: clearing the ccp1con register will force the ccp1 compare output latch to the default low level. this is not the port i/o data latch. ccpr1h ccpr1l tmr1h tmr1l comparator qs r output logic special event trigger set ccp1if interrupt flag (pir2) match tris ccp1m<3:0> mode select output enable pin ccp1 4 note: clocking timer1 from the system clock (f osc ) should not be used in compare mode. in order for compare mode to recognize the trigger event on the ccp1 pin, timer1 must be clocked from the instruction clock (f osc /4) or from an external clock source. table 10-2: special event trigger device ccp1 pic12f752 pic12hv752 ccp1 note 1: the special event trigger from the ccp module does not set interrupt flag bit tmr1if of the pir1 register. 2: removing the match condition by changing the contents of the ccpr1h and ccpr1l register pair, between the clock edge that generates the special event trigger and the clock edge that generates the timer1 reset, will preclude the reset from occurring.
pic12f752/hv752 ds41576b-page 80 preliminary ? 2011 microchip technology inc. 10.2.5 compare during sleep the compare mode is dependent upon the system clock (f osc ) for proper operation. since f osc is shut down during sleep mode, the compare mode will not function properly during sleep. table 10-3: summary of regist ers associated with compare name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ccp1con ? ? dc1b<1:0> ccp1m<3:0> 83 ccpr1l capture/compare/pwm register 1 low byte (lsb) 77 ccpr1h capture/compare/pwm register 1 high byte (msb) 77 intcon gie peie t0ie inte iocie t0if intf iocif 20 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 20 pie2 ? ? c2ie c1ie ? cog1ie ? ccp1ie 20 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 20 pir2 ? ? c2if c1if ? cog1if ? ccp1if 20 t1con tmr1cs<1:0> t1ckps<1:0> reserved t1sync ?tmr1on 67 t1gcon tmr1ge t1gpol t1gtm t1gspm t1ggo/done t1gval t1gss<1:0> 68 tmr1h holding register for the most significant byte of the 16-bit tmr1 register 59 * tmr1l holding register for the least significant byte of the 16-bit tmr1 register 59 * trisa ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 48 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by compare mode. * page provides register information. note 1: trisa3 always reads ? 1 ?.
? 2011 microchip technology inc. preliminary ds41576b-page 81 pic12f752/hv752 10.3 pwm overview pulse-width modulation (pwm) is a scheme that provides power to a load by switching quickly between fully on and fully off states. the pwm signal resembles a square wave where the high portion of the signal is considered the on state and the low portion of the signal is considered the off state. the high portion, also known as the pulse width, can vary in time and is defined in steps. a larger number of steps applied, which lengthens the pulse width, also supplies more power to the load. lowering the number of steps applied, which shortens the pulse width, supplies less power. the pwm period is defined as the duration of one complete cycle or the total amount of on and off time combined. pwm resolution defines the maximum number of steps that can be present in a single pwm period. a higher resolution allows for more precise control of the pulse width time and in turn the power that is applied to the load. the term duty cycle describes the proportion of the on time to the off time and is expressed in percentages, where 0% is fully off and 100% is fully on. a lower duty cycle corresponds to less power applied and a higher duty cycle corresponds to more power applied. figure 10-3 shows a typical waveform of the pwm signal. 10.3.1 standard pwm operation the standard pwm mode generates a pulse-width modulation (pwm) signal on the ccp1 pin with up to 10 bits of resolution. the period, duty cycle, and resolution are controlled by the following registers: ? pr2 registers ? t2con registers ? ccpr1l registers ? ccp1con registers figure 10-4 shows a simplified block diagram of pwm operation. figure 10-3: ccp1 pwm output signal figure 10-4: simplified pwm block diagram note 1: the corresponding tris bit must be cleared to enable the pwm output on the ccp1 pin. 2: clearing the ccp1con register will relinquish control of the ccp1 pin. period pulse width tmr2 = 0 tmr2 = ccpr1h:ccp1con<5:4> tmr2 = pr2 ccpr1l ccpr1h (2) (slave) comparator tmr2 pr2 (1) rq s duty cycle registers ccp1con<5:4> clear timer, toggle ccp1 pin and latch duty cycle note 1: the 8-bit timer tmr2 register is concatenated with the 2-bit internal system clock (f osc ), or 2 bits of the prescaler, to create the 10-bit time base. 2: in pwm mode, ccpr1h is a read-only register. tris ccp1 comparator
pic12f752/hv752 ds41576b-page 82 preliminary ? 2011 microchip technology inc. 10.3.2 setup for pwm operation the following steps should be taken when configuring the ccp1 module for standard pwm operation: 1. disable the ccp1 pin output driver by setting the associated tris bit. 2. load the pr2 register with the pwm period value. 3. configure the ccp1 module for the pwm mode by loading the ccp1con register with the appropriate values. 4. load the ccpr1l register and the dc1b<1:0> bits of the ccp1con register, with the pwm duty cycle value. 5. configure and start timer2: ? clear the tmr2if interrupt flag bit of the pir1 register. see note below. ? configure the t2ckps bits of the t2con register with the timer prescale value. ? enable the timer by setting the tmr2on bit of the t2con register. 6. enable pwm output pin: ? wait until the timer overflows and the tmr2if bit of the pir1 register is set. see note below. ? enable the ccp1 pin output driver by clear- ing the associated tris bit. 10.3.3 pwm period the pwm period is specified by the pr2 register of timer2. the pwm period can be calculated using the formula of equation 10-1 . equation 10-1: pwm period when tmr2 is equal to pr2, the following three events occur on the next increment cycle: ?tmr2 is cleared ? the ccp1 pin is set. (exception: if the pwm duty cycle = 0%, the pin will not be set.) ? the pwm duty cycle is latched from ccpr1l into ccpr1h. 10.3.4 pwm duty cycle the pwm duty cycle is specified by writing a 10-bit value to multiple registers: ccpr1l register and dc1b<1:0> bits of the ccp1con register. the ccpr1l contains the eight msbs and the dc1b<1:0> bits of the ccp1con register contain the two lsbs. ccpr1l and dc1b<1:0> bits of the ccp1con register can be written to at any time. the duty cycle value is not latched into ccpr1h until after the period completes (i.e., a match between pr2 and tmr2 registers occurs). while using the pwm, the ccpr1h register is read-only. equation 10-2 is used to calculate the pwm pulse width. equation 10-3 is used to calculate the pwm duty cycle ratio. equation 10-2: pulse width equation 10-3: duty cycle ratio the ccpr1h register and a 2-bit internal latch are used to double buffer the pwm duty cycle. this double buffering is essential for glitchless pwm operation. the 8-bit timer tmr2 register is concatenated with either the 2-bit internal system clock (f osc ), or 2 bits of the prescaler, to create the 10-bit time base. the system clock is used if the timer2 prescaler is set to 1:1. when the 10-bit time base matches the ccpr1h and 2-bit latch, then the ccp1 pin is cleared (see figure 10-4 ). note: in order to send a complete duty cycle and period on the first pwm output, the above steps must be included in the setup sequence. if it is not critical to start with a complete pwm signal on the first output, then step 6 may be ignored. pwm period pr 2 ?? 1 + ?? 4t osc ? ? ? = (tmr2 prescale value) note 1: t osc = 1/f osc note: the timer postscaler (see section 8.1 ?timer2 operation? ) is not used in the determination of the pwm frequency. pulse width ccpr1l:ccp1con<5:4> ?? ? = t osc ? (tmr2 prescale value) duty cycle ratio ccprxl:ccpxcon<5:4> ?? 4 prx 1 + ?? ---------------------------------------------------------------------- - =
? 2011 microchip technology inc. preliminary ds41576b-page 83 pic12f752/hv752 10.4 ccp control registers register 10-1: ccp1con: ccp1 control register u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? dc1b<1:0> ccp1m<3:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other reset ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented: read as ? 0 ? bit 5-4 dc1b<1:0>: pwm duty cycle least significant bits capture mode: unused compare mode: unused pwm mode: these bits are the two lsbs of the pwm duty cycle. the eight msbs are found in ccpr1l. bit 3-0 ccp1m<3:0>: ccp1 mode select bits 0000 = capture/compare/pwm off (resets ccp1 module) 0001 = reserved 0010 = compare mode: toggle output on match 0011 = reserved 0100 = capture mode: every falling edge 0101 = capture mode: every rising edge 0110 = capture mode: every 4th rising edge 0111 = capture mode: every 16th rising edge 1000 = compare mode: initialize ccp1 pin low; set output on compare match (set ccp1if) 1001 = compare mode: initialize ccp1 pin high; clear output on compare match (set ccp1if) 1010 = compare mode: generate software interrupt only; ccp1 pin reverts to i/o state 1011 = compare mode: special event trigger (ccp1 resets timer, sets ccp1if bit, and starts a/d conversion if a/d module is enabled) 11xx = pwm mode
pic12f752/hv752 ds41576b-page 84 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 85 pic12f752/hv752 11.0 complementary output generator (cog) module the primary purpose of the complementary output generator (cog) is to convert a single output pwm sig- nal into a two output complementary pwm signal. the cog can also convert two separate input events into a single or complementary pwm output. the cog pwm frequency and duty cycle are deter- mined by a rising event input and a falling event input. the rising event and falling event may be the same source. sources may be synchronous or asynchronous to the cog_clock. the rate at which the rising event occurs determines the pwm frequency. the time from the rising event input to the falling event input determines the duty cycle. a selectable clock input is used to generate the phase delay, blanking and dead-band times. a simplified block diagram of the cog is shown in figure 11-1 . the cog module has the following features: ? selectable clock source ? selectable rising event source ? selectable falling event source ? selectable edge or level event sensitivity ? independent output enables ? independent output polarity selection ?phase delay ? dead-band control with independent rising and falling event dead-band times ? blanking control with independent rising and fall- ing event blanking times ? auto-shutdown control with: - selectable shutdown sources - auto-restart enable - auto-shutdown pin override control 11.1 fundamental operation the cog generates a two output complementary pwm waveform from rising and falling event sources. in the simplest configuration, the rising and falling event sources are the same signal, which is a pwm signal with the desired period and duty cycle. the cog converts this single pwm input into a dual complemen- tary pwm output. the frequency and duty cycle of the dual pwm output match those of the single input pwm signal. the off-to-on transition of each output can be delayed from the on-to-off transition of the other output, thereby, creating a time immediately after the pwm transition where neither output is driven. this is referred to as dead time and is covered in section 11.5 ?dead-band control? . a typical operating waveform, with dead band, generated from a single ccp1 input is signal is shown in figure 11-2 . the cog can also generate a pwm waveform from a periodic rising event and a separate falling event. in this case, the falling event is usually derived from analog feedback within the external pwm driver circuit. in this configuration, high power switching transients may trigger a false falling event that needs to be blanked out. the cog can be configured to blank falling (and rising) event inputs for a period of time immediately following the rising (and falling) event drive output. this is referred to as input blanking and is covered in section 11.6 ?blanking control? . it may be necessary to guard against the possibility of circuit faults. in this case, the active drive must be ter- minated before the fault condition causes damage. this is referred to as auto-shutdown and is covered in section 11.8 ?auto-shutdown control? . a feedback falling event arriving too late or not at all o can be terminated with auto-shutdown or by using one of the event inputs that is logically or?d with the hard- ware limit timer (hlt). see section 9.0 ?hardware limit timer (hlt) module? for more information about the hlt. the cog can be configured to operate in phase delayed conjunction with another pwm. the active drive cycle is delayed from the rising event by a phase delay timer. phase delay is covered in more detail in section 11.7 ?phase delay? . a typical operating waveform, with phase delay and dead band, generated from a single ccp1 input is shown in figure 11-3 .
pic12f752/hv752 ds41576b-page 86 preliminary ? 2011 microchip technology inc. figure 11-1: simplified cog block diagram cog_clock gxcs<1:0> c1out c2out ccp1 gxrs0<2:0> gxfs0<2:0> gxout1ss gxout0ss cog1out0 cog1out1 fosc gxdbr<3:0> gxdbf<3:0> gxpol0 gxpol1 cogxflt gxasdsflt c1out gxasdsc1 c2out gxasdsc2 hltimer1 output gxasdshlt gxarsen fosc/4 hfintosc sq r phase dead band cnt/r dead band cnt/r blanking cnt/r delay gxoe0 gxoe1 gxblkr<3:0> gxph<3:0> 0 00 1 2 01 10 0 1 0 1 blanking cnt/r gxblkf<3:0> sq r dq write gxasde low gxasde auto-shutdown source set dominates write gxasde high rising event source falling event source q hltimer1 or c1out hltimer1 or c2out hltimer1 or ccp1 4 5 6 cogxflt 3 hltimer1 or cogxflt 7 c1out c2out ccp1 0 1 2 hltimer1 or c1out hltimer1 or c2out hltimer1 or ccp1 4 5 6 cogxflt 3 hltimer1 or cogxflt 7 0 1 0 1 gxrsim gxfsim = = = = reset dominates s gxen
? 2011 microchip technology inc. preliminary ds41576b-page 87 pic12f752/hv752 figure 11-2: typical cog operation with ccp1 figure 11-3: cog operation with ccp1 and phase delay falling source dead band rising source dead band falling source dead band cog_clock ccp1 cogxout0 cogxout1 source falling source dead rising source dead band phase delay falling source dead band ccp1 cogxout0 cogxout1 cog_clock source band
pic12f752/hv752 ds41576b-page 88 preliminary ? 2011 microchip technology inc. 11.2 clock sources the cog_clock is used as the reference clock to the various timers in the peripheral. timers that use the cog_clock include: ? rising and falling dead-band time ? rising and falling blanking time ? rising event phase delay clock sources available for selection include: ? 8 mhz hfintosc ? instruction clock (fosc/4) ? system clock (fosc) the clock source is selected with the gxcs<1:0> bits of the cogxcon0 register ( register 11-1 ). 11.3 selectable event sources the cog uses two independently selectable event sources to generate the complementary waveform: ? rising event source ? falling event source level or edge sensitive modes are available for each event input. the rising event source is selected with the gxrs<2:0> bits and the mode is controlled with the gxrsim bit. the falling event source is selected with the gxfs<2:0> bits and the mode is controlled with the gxfsim bit. selection and mode control bits for both sources are located in the cogxcon1 register ( register 11-2 ). 11.3.1 edge vs. level sensing event input detection may be selected as level or edge sensitive. in general, events that are driven from a peri- odic source should be edge detected and events that are derived from voltage thresholds at the target circuit should be level sensitive. consider the following two examples: 1. the first example is an application in which the period is determined by a 50% duty cycle clock and the cog output duty cycle is determined by a voltage level fed back through a comparator. if the clock input is level sensitive then duty cycles less than 50% will exhibit erratic operation. 2. the second example is similar to the first except that the duty cycle is close to 100%. the feedback compar- ator high-to-low transition trips the cog drive off but almost immediately the period source turns the drive back on. if the off cycle is short enough then the com- parator input may not reach the low side of the hyster- esis band precluding an output change. the comparator output stays low and without a high-to-low transition to trigger the edge sense then the drive of the cog output will be stuck in a constant drive-on condi- tion. see figure 11-4 . figure 11-4: edge vs level sense 11.3.2 rising event the rising event starts the pwm output active duty cycle period. the rising event is the low-to-high transition of the selected rising event source. when the phase delay and rising event dead-band time values are zero, the cogxout0 output starts immediately. otherwise, the cogxout0 output is delayed. the rising event causes all the following actions: ? start rising event phase delay counter (if enabled). ? clear cogxout1 after phase delay. ? start falling event input blanking (if enabled). ? start dead-band counter (if enabled). ? set cogxout0 output after dead-band counter expires. 11.3.3 falling event the falling event terminates the pwm output active duty cycle period. the falling event is the high-to-low transition of the selected falling event source. when the falling event dead-band time value is zero, the cogxout1 output starts immediately. otherwise, the cogxout1 output is delayed. the falling event causes all the following actions: ? clear cogxout0. ? start rising event input blanking (if enabled). ? start falling event dead-band counter (if enabled). ? set cogxout1 output after dead-band counter expires. rising (ccp1) falling (c1out) c1in- cogout hyst edge sensitive rising (ccp1) falling (c1out) c1in- cogout hyst
? 2011 microchip technology inc. preliminary ds41576b-page 89 pic12f752/hv752 11.4 output control immediately after the cog module is enabled, the complementary drive is configured with cogxout0 drive cleared and cogxout1 drive active. 11.4.1 output enables each cog output pin has individual output enable controls. output enables are selected with the gxoe0 and gxoe1 bits of the cogxcon0 register. when an output enable control is cleared, the module asserts no control over the pin. when an output enable is set, the override value or active pwm waveform is applied to the pin per the port priority selection. the output pin enables are independent of the module enable bit, gxen. when gxen is cleared, the shutdown override levels are present on the cog output pins for which the output enables are active. 11.4.2 polarity control the polarity of each cog output can be selected independently. when the output polarity bit is set, the corresponding output is active low. clearing the output polarity bit configures the corresponding output as active high. however, polarity does not affect the override levels. output polarity is selected with the gxpol0 and gxpol1 bits of the cogxcon0 register. 11.5 dead-band control the dead-band control provides for non-overlapping pwm output signals to prevent shoot through current in the external power switches. the cog contains two 4-bit dead-band counters. one dead-band counter is used for rising event dead-band control. the other is used for falling event dead-band control. dead band is timed by counting cog_clock periods from zero up to the value in the dead-band count register. use equation 11-1 to calculate dead-band times. 11.5.1 rising event dead band rising event dead-band delays the turn-on of cogxout0 from when cogxout1 is turned off. the rising event dead-band time starts when the rising event output goes true. the rising event output into the dead-band counter may be delayed by the phase delay. when the phase delay time is zero, the rising event output goes true coincident with the unblanked rising input event. when the phase delay time is not zero, the rising event out- put goes true at the completion of the phase delay time. the rising event dead-band time is set by the value contained in the gxdbr<3:0> bits of the cogxdb register. when the value is zero, rising event dead band is disabled. 11.5.2 falling event dead band falling event dead-band delays the turn-on of cogxout1 from when cogxout0 is turned off. the falling event dead-band time starts when the falling event output goes true. the falling event output goes true coincident with the unblanked falling input event. the falling event dead-band time is set by the value contained in the gxdbf<3:0> bits of the cogxdb register. when the value is zero, falling event dead band is disabled. 11.5.3 dead-band time uncertainty when the rising and falling events that trigger the dead-band counters come from asynchronous inputs, it creates uncertainty in the dead-band time. the max- imum uncertainty is equal to one cog_clock period. refer to equation 11-1 for more detail. 11.5.4 dead-band overlap there are two cases of dead-band overlap: ? rising-to-falling ? falling-to-rising 11.5.4.1 rising-to-falling overlap in this case, the falling event occurs while the rising event dead-band counter is still counting. when this happens, the cogxout0 drive is suppressed and the dead band extends by the falling event dead-band time. at the termination of the extended dead-band time, the cogxout1 drive goes true. 11.5.4.2 falling-to-rising overlap in this case, the rising event occurs while the falling event dead-band counter is still counting. when this happens, the cogxout1 drive is suppressed and the dead band extends by the rising event dead-band time. at the termination of the extended dead-band time, the cogxout0 drive goes true.
pic12f752/hv752 ds41576b-page 90 preliminary ? 2011 microchip technology inc. 11.6 blanking control input blanking is a function whereby the event inputs can be masked or blanked for a short period of time. this is to prevent electrical transients caused by the turn-on/off of power components from generating a false input event. the cog contains two 4-bit blanking counters. the counters are cross coupled with the events they are blanking. the falling event blanking counter is used to blank rising input events and the rising event blanking counter is used to blank falling input events. once started, blanking extends for the time specified by the corresponding blanking counter. blanking is timed by counting cog_clock periods from zero up to the value in the blanking count register. use equation 11-1 to calculate blanking times. 11.6.1 rising event input blanking the falling event blanking counter inhibits the rising input from triggering a rising event. the falling event blanking time starts when the falling event output drive goes true. the falling event blanking time is set by the value con- tained in the gxblkf<3:0> bits of the cogxblk reg- ister. blanking times are calculated using the formula shown in equation 11-1 . when the gxblkf<3:0> value is zero, falling event blanking is disabled and the blanking counter output is true, thereby, allowing the event signal to pass straight through to the event trigger circuit. 11.6.2 falling event input blanking the rising event blanking counter inhibits the falling input from triggering a falling event. the rising event blanking time starts when the rising event output drive goes true. the rising event blanking time is set by the value contained in the gxblkr<3:0> bits of the cogxblk register. when the gxblkr<3:0> value is zero, rising event blanking is disabled and the blanking counter output is true, thereby, allowing the event signal to pass straight through to the event trigger circuit. 11.6.3 blanking time uncertainty when the rising and falling events that trigger the blanking counters are asynchronous to the cog_clock, it creates uncertainty in the blanking time. the maximum uncertainty is equal to one cog_clock period. refer to equation 11-1 and example 11-1 for more detail. 11.7 phase delay it is possible to delay the assertion of the rising event. this is accomplished by placing a non-zero value in cogxph register. refer to register 11-6 and figure 11-3 for cog operation with ccp1 and phase delay. the delay from the input rising event signal switching to the actual assertion of the events is calcu- lated the same as the dead-band and blanking delays. please see equation 11-1 . when the cogxph value is zero, phase delay is dis- abled and the phase delay counter output is true, thereby, allowing the event signal to pass straight through to complementary output driver flop. 11.7.1 cumulative uncertainty it is not possible to create more than one cog_clock of uncertainty by successive stages. consider that the phase delay stage comes after the blanking stage, the dead-band stage comes after either the blanking or phase delay stages, and the blanking stage comes after the dead-band stage. when the preceding stage is enabled, the output of that stage is necessarily synchronous with the cog_clock, which removes any possibility of uncertainty in the succeeding stage. equation 11-1: phase, dead-band, and blanking time calculation t min count = t max count 1 + f cog _clock ------------------------- - = t uncertainty t max t min ? = t uncertainty 1 f cog _clock ------------------------- - = also: where: t count phase delay gxph<3:0> rising dead band gxdbr<3:0> falling dead band gxdbf<3:0> rising event blanking gxblkr<3:0> falling event blanking gxblkf<3:0> cog_clock f
? 2011 microchip technology inc. preliminary ds41576b-page 91 pic12f752/hv752 example 11-1: timer uncertainty given: therefore: count ah 10 d == f cog _clock 8mhz = t uncertainty 1 f cog _clock ------------------------- - = 1 8 mhz --------------- = 125 ns = proof: t min count f cog _clock ------------------------- - = 125 ns 10 d ? = 1.25 ? s = t max count 1 + f cog _clock ------------------------- - = 125 ns 10 d 1 + ?? ? = 1.375 ? s = therefore: t uncertainty t max t min ? = 1.375 ? s 1.25 ? s ? = 125 ns =
pic12f752/hv752 ds41576b-page 92 preliminary ? 2011 microchip technology inc. 11.8 auto-shutdown control auto-shutdown is a method to immediately override the cog output levels with specific overrides that allow for safe shutdown of the circuit. the shutdown state can be either cleared automati- cally or held until cleared by software. 11.8.1 shutdown the shutdown state can be entered by either of the following two mechanisms: ? software generated ? external input 11.8.1.1 software generated shutdown setting the gxasde bit of the cogxasd register will force the cog into the shutdown state. when auto-restart is disabled, the shutdown state will persist as long as the gxasde bit is set. when auto-restart is enabled, the gxasde bit will clear automatically and resume operation on the next rising event. see figure 11-5 . 11.8.1.2 external shutdown source external shutdown inputs provide the fastest way to safely suspend cog operation in the event of a fault condition. when any of the selected shutdown inputs goes true, the output drive latches are reset and the cog outputs will immediately go to the selected over- ride levels without software delay. any combination of four input sources can be selected to cause a shutdown condition. the four sources include: ? hltimer1 output ? c2out (low true) ? c1out (low true) ? cog1flt pin (low true) shutdown inputs are selected independently with bits <3:0> of the cogxasd register ( register 11-3 ). 11.8.2 pin override levels the levels driven to the output pins, while the shut- down input is true, are controlled by the gxasdl0 and gxasdl1 bits of the cogxasd register ( register 11-3 ). gxasdl0 controls the gxout0 over- ride level and gxasdl1 controls the gxout1 over- ride level. the control bit logic level corresponds to the output logic drive level while in the shutdown state. 11.8.3 auto-shutdown restart after an auto-shutdown event has occurred, there are two ways to have the module resume operation: ? software controlled ? auto-restart the restart method is selected with the gxarsen bit of the cogxasd register. waveforms of a software controlled automatic restart are shown in figure 11-5 . 11.8.3.1 software controlled restart when the gxarsen bit of the cogxasd register is cleared, the cog must be restarted after an auto-shutdown event by software. the cog will resume operation on the first rising event after the gxasde bit is cleared. clearing the shutdown state requires all selected shutdown inputs to be false, otherwise, the gxasde bit will remain set. 11.8.3.2 auto-restart when the gxarsen bit of the cogxasd register is set then the cog will restart from the auto-shutdown state automatically. the gxasde bit will clear automatically and the cog will resume operation on the first rising event after all selected shutdown inputs go false. note: shutdown inputs are level sensitive, not edge sensitive. the shutdown state cannot be cleared as long as the shutdown input level persists, except by disabling auto-shutdown, note: the polarity control does not apply to the override level.
? 2011 microchip technology inc. preliminary ds41576b-page 93 pic12f752/hv752 figure 11-5: auto-shutdown waveform ? ccp1 as rising and falling event input source 1 2 3 4 5 next rising event next rising event cleared in software cleared in hardware normal output shutdown normal output shutdown normal output software controlled restart auto-restart ccp1 gxarsen shutdown input gxasde gxasdl0 gxasdl1 cogxout0 cogxout1 operating state
pic12f752/hv752 ds41576b-page 94 preliminary ? 2011 microchip technology inc. 11.9 buffer updates changes to the phase, dead band, and blanking count registers need to occur simultaneously during cog operation to avoid unintended operation that may occur as a result of delays between each register write. this is accomplished with the gxld bit of the cogxcon0 register and double buffering of the phase, blanking, and dead-band count registers. before the cog module is enabled, writing the count registers loads the count buffers without need of the gxld bit. however, when the cog is enabled, the count buffers updates are suspended after writing the count registers until after the gxld bit is set. when the gxld bit is set, the phase, dead band, and blanking register values are transferred to the corresponding buffers synchronous with cog operation. the gxld bit is cleared by hardware when the transfer is complete. 11.10 alternate pin selection the cogxout0, cogxout1 and cogxflt func- tions can be directed to alternate pins with control bits of the apfcon register. refer to register 5-1 . 11.11 operation during sleep the cog continues to operate in sleep provided that the cog_clock, rising event, and falling event sources remain active. the hfintsoc remains active during sleep when the cog is enabled and the hfintosc is selected as the cog_clock source. 11.12 configuring the cog the following steps illustrate how to properly configure the cog to ensure a synchronous start with the rising event input: 1. configure the desired cogxflt input, cogxout0 and cogxout1 pins with the cor- responding bits in the apfcon register. 2. clear all ansela register bits associated with pins that are used for cog functions. 3. ensure that the tris control bits corresponding to cogxout0 and cogxout1 are set so that both are configured as inputs. these will be set as outputs later. 4. clear the gxen bit, if not already cleared. 5. set desired dead-band times with the cogxdb register. 6. set desired blanking times with the cogxblk register. 7. set desired phase delay with the cogxph register. 8. setup the following controls in cogxasd auto-shutdown register: ? select desired shutdown sources. ? select both output overrides to the desired levels (this is necessary, even if not using auto-shutdown because start-up will be from a shutdown state). ? set the gxasde bit and clear the gxarsen bit. 9. select the desired rising and falling event sources and input modes with the cogxcon1 register. 10. configure the following controls in cogxcon0 register: ? select the desired clock source ? select the desired output polarities ? set the output enables of the outputs to be used. 11. set the gxen bit. 12. clear tris control bits corresponding to cogxout0 and cogxout1 to be used, thereby configuring those pins as outputs. 13. if auto-restart is to be used, set the gxarsen bit and the gxasde will be cleared automatically. otherwise, clear the gxasde bit to start the cog. note: the default cog outputs have high drive strength capability, whereas the alternate outputs do not.
? 2011 microchip technology inc. preliminary ds41576b-page 95 pic12f752/hv752 11.13 cog control registers register 11-1: cogxcon0: cog control register 0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 gxen gxoe1 gxoe0 gxpol1 gxpol0 gxld gxcs<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 gxen: cogx enable bit 1 = module is enabled 0 = module is disabled bit 6 gxoe1: cogxout1 output enable bit 1 = cogxout1 is available on associated i/o pin 0 = cogxout1 is not available on associated i/o pin bit 5 gxoe0: cogxout0 output enable bit 1 = cogxout0 is available on associated i/o pin 0 = cogxout0 is not available on associated i/o pin bit 4 gxpol1: cogxout1 output polarity bit 1 = output is inverted polarity 0 = output is normal polarity bit 3 gxpol0: cogxout0 output polarity bit 1 = output is inverted polarity 0 = output is normal polarity bit 2 gxld: cogx load buffers bit 1 = phase, blanking, and dead-band buffers to be loaded with register values on next input events 0 = register to buffer transfer is complete bit 1-0 gxcs<1:0>: cogx clock source select bits 11 = reserved 10 = 8 mhz hfintosc clock 01 = instruction clock (fosc/4) 00 = system clock (fosc)
pic12f752/hv752 ds41576b-page 96 preliminary ? 2011 microchip technology inc. register 11-2: cogxcon1: cog control register 1 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 gxfsim gxrsim gxfs<2:0> gxrs<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 gxfsim: cogx falling source input mode bit 1 = input is edge sensitive 0 = input is level sensitive bit 6 gxrsim: cogx rising source input mode bit 1 = input is edge sensitive 0 = input is level sensitive bit 5-3 gxfs<2:0>: cogx falling source select bits 111 = cogxflt or hltimer1 110 = ccp1 or hltimer1 101 = c2out or hltimer1 100 = c1out or hltimer1 011 =cogxflt 010 = ccp1 001 =c2out 000 =c1out bit 2-0 gxrs<2:0>: cogx rising source select bits 111 = cogxflt or hltimer1 110 = ccp1 or hltimer1 101 = c2out or hltimer1 100 = c1out or hltimer1 011 = cogxflt 010 = ccp1 001 =c2out 000 =c1out
? 2011 microchip technology inc. preliminary ds41576b-page 97 pic12f752/hv752 register 11-3: cogxasd: cog auto-shutdown control register r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 gxasde gxarsen gxasdl1 gxasdl0 gxasdshlt gxasdsc2 gxasdsc1 gxasdsflt bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 gxasde: auto-shutdown event status bit 1 = cog is in the shutdown state 0 = cog is not in the shutdown state bit 6 gxarsen: auto-restart enable bit 1 = auto-restart is enabled 0 = auto-restart is disabled bit 5 gxasdl1: cogxout1 auto-shutdown override level bit 1 =a logic ? 1 ? is placed on cogxout1 when a shutdown input is true 0 =a logic ? 0 ? is placed on cogxout1 when a shutdown input is true bit 4 gxasdl0: cogxout0 auto-shutdown override level bit 1 =a logic ? 1 ? is placed on cogxout0 when a shutdown input is true 0 =a logic ? 0 ? is placed on cogxout0 when a shutdown input is true bit 3 gxasdshlt: cog auto-shutdown source enable bit 3 1 = cog is shutdown when hltmr equals hltpr is low 0 = hltimer1 pin has no effect on shutdown bit 2 gxasdsc2: cog auto-shutdown source enable bit 2 1 = cog is shutdown when c2out is low 0 = c2out pin has no effect on shutdown bit 1 gxasdsc1: cog auto-shutdown source enable bit 1 1 = cog is shutdown when c1out is low 0 = c1out pin has no effect on shutdown bit 0 gxasdsflt: cog auto-shutdown source enable bit 0 1 = cog is shutdown when cogxflt pin is low 0 = cogxflt pin has no effect on shutdown
pic12f752/hv752 ds41576b-page 98 preliminary ? 2011 microchip technology inc. register 11-4: cogxdb: cog dead-band count register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u gxdbr<3:0> gxdbf<3:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-4 gxdbr<3:0>: rising event dead-band count value bits = number of cog clock periods to delay primary output after rising event input bit 3-0 gxdbf<3:0>: falling event dead-band count value bits = number of cog clock periods to delay complementary output after falling event input register 11-5: cogxblk: cog blanking count register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u gxblkr<3:0> gxblkf<3:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-4 gxblkr<3:0>: rising event blanking count value bits = number of cogx clock periods to inhibit falling event input bit 3-0 gxblkf<3:0>: falling event blanking count value bits = number of cogx clock periods to inhibit rising event input register 11-6: cogxph: cog phase count register u-0 u-0 u-0 u-0 r/w-x/u r/w-x/u r/w-x/u r/w-x/u ? ? ? ? gxph<3:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-4 unimplemented: read as ? 0 ? bit 3-0 gxph<3:0>: rising event phase delay count value bits = number of cog clock periods to delay rising edge event
? 2011 microchip technology inc. preliminary ds41576b-page 99 pic12f752/hv752 table 11-1: summary of register s associated with cog name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ansela ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 50 apfcon ? ? ? t1gsel ? cog1fsel cog1o1sel cog1o0sel 46 cog1ph ? ? ? ? g1ph<3:0> 98 cog1blk g1blkr<3:0> g1blkf<3:0> 98 cog1db g1dbr<3:0> g1dbf<3:0> 98 cog1con0 g1en g1oe1 g1oe0 g1pol1 g1pol0 g1ld g1cs1 g1cs0 95 cog1con1 g1fsim g1rsim g1fs<2:0> g1rs<2:0> 96 cog1asd g1asde g1arsen g1asdl1 g1asdl0 g1asdshlt g1asdsc2 g1asdsc1 g1asdsflt 97 intcon gie peie t0ie inte iocie t0if intf iocif 20 lata ? ?lata5lata4 ?lata2 lata1 lata0 48 pie2 ? ? c2ie c1ie ?cog1ie ? ccp1ie 22 pir2 ? ? c2if c1if ?cog1if ? ccp1if 24 trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 48 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ? 0 ?. shaded cells are not used by cog. note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation. 2: see configuration word register ( register 17-1 ) for operation of all register bits.
pic12f752/hv752 ds41576b-page 100 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 101 pic12f752/hv752 12.0 analog-to-digital converter (adc) module the analog-to-digital converter (adc) allows conversion of an analog input signal to a 10-bit binary representation of that signal. this device uses analog inputs, which are multiplexed into a single sample and hold circuit. the output of the sample and hold is connected to the input of the converter. the converter generates a 10-bit binary result via successive approximation and stores the conversion result into the adc result registers (adresl and adresh). the adc voltage reference is software selectable to either v dd or a voltage applied to the external reference pins. the adc can generate an interrupt upon completion of a conversion. this interrupt can be used to wake-up the device from sleep. figure 12-1 shows the block diagram of the adc. figure 12-1: adc block diagram note: the adresl and adresh registers are read-only. an0 a/d an1/v ref + an2 v dd v ref + adon go/done vcfg = 1 vcfg = 0 chs<3:0> vss dac_ref fvr_ref an3 adresh adresl 10 10 adfm 0 = left justify 1 = right justify 0000 0001 0010 0011 1110 1111
pic12f752/hv752 ds41576b-page 102 preliminary ? 2011 microchip technology inc. 12.1 adc configuration when configuring and using the adc the following functions must be considered: ? port configuration ? channel selection ? adc voltage reference selection ? adc conversion clock source ? interrupt control ? results formatting 12.1.1 port configuration the adc can be used to convert both analog and digital signals. when converting analog signals, the i/o pin should be configured for analog by setting the associated tris and ansel bits. see the corresponding port section for more information. 12.1.2 channel selection the chs bits of the adcon0 register determine which channel is connected to the sample and hold circuit. when changing channels, a delay is required before starting the next conversion. refer to section 12.2 ?adc operation? for more information. 12.1.3 adc v oltage reference the vcfg bit of the adcon0 register provides control of the positive voltage reference. the positive voltage reference can be either v dd or an external voltage source. the negative voltage reference is always connected to the ground reference. 12.1.4 conversion clock the source of the conversion clock is software selectable via the adcs bits of the adcon1 register. there are seven possible clock options: ?f osc /2 ?f osc /4 ?f osc /8 ?f osc /16 ?f osc /32 ?f osc /64 ?f rc (dedicated internal oscillator) the time to complete one bit conversion is defined as t ad . one full 10-bit conversion requires 11 t ad periods as shown in figure 12-2 . for correct conversion, the appropriate t ad specification must be met. see a/d conversion requirements in section 20.0 ?electrical specifications? for more information. table 12-1 gives examples of appropriate adc clock selections. note: analog voltages on any pin that is defined as a digital input may cause the input buf- fer to conduct excess current. note: unless using the f rc , any changes in the system clock frequency will change the adc clock frequency, which may adversely affect the adc result.
? 2011 microchip technology inc. preliminary ds41576b-page 103 pic12f752/hv752 table 12-1: adc c lock p eriod (t ad ) v s . d evice o perating f requencies (v dd > 3.0v) figure 12-2: analog-to-dig ital conversion t ad cycles 12.1.5 interrupts the adc module allows for the ability to generate an interrupt upon completion of an analog-to-digital conversion. the adc interrupt flag is the adif bit in the pir1 register. the adc interrupt enable is the adie bit in the pie1 register. the adif bit must be cleared in software. this interrupt can be generated while the device is operating or while in sleep. if the device is in sleep, the interrupt will wake-up the device. upon waking from sleep, the next instruction following the sleep instruction is always executed. if the user is attempting to wake-up from sleep and resume in-line code execution, the global interrupt must be disabled. if the global interrupt is enabled, execution will switch to the interrupt service routine. adc clock period (t ad ) device frequency (f osc ) adc clock source adcs<2:0> 20 mhz 8 mhz 4 mhz 1 mhz f osc /2 000 100 ns (2) 250 ns (2) 500 ns (2) 2.0 ? s f osc /4 100 200 ns (2) 500 ns (2) 1.0 ? s (2) 4.0 ? s f osc /8 001 400 ns (2) 1.0 ? s (2) 2.0 ? s 8.0 ? s (3) f osc /16 101 800 ns (2) 2.0 ? s4.0 ? s 16.0 ? s (3) f osc /32 010 1.6 ? s4.0 ? s 8.0 ? s (3) 32.0 ? s (3) f osc /64 110 3.2 ? s 8.0 ? s (3) 16.0 ? s (3) 64.0 ? s (3) f rc x11 2-6 ? s (1,4) 2-6 ? s (1,4) 2-6 ? s (1,4) 2-6 ? s (1,4) legend: shaded cells are outside of recommended range. note 1: the f rc source has a typical t ad time of 4 ? s for v dd > 3.0v. 2: these values violate the minimum required t ad time. 3: for faster conversion times, the selection of another clock source is recommended. 4: when the device frequency is greater than 1 mhz, the f rc clock source is only recommended if the conversion will be performed during sleep. t ad 1 t ad 2 t ad 3 t ad 4 t ad 5 t ad 6 t ad 7 t ad 8 t ad 9 set go/done bit holding capacitor is disconnected fr om analog input (typically 100 ns) b9 b8 b7 b6 b5 b4 b3 b2 t ad 10 t ad 11 b1 b0 t cy to t ad conversion starts adresh and adresl registers are loaded, go bit is cleared, adif bit is set, holding capacitor is connected to analog input note: the adif bit is set at the completion of every conversion, regardless of whether or not the adc interrupt is enabled.
pic12f752/hv752 ds41576b-page 104 preliminary ? 2011 microchip technology inc. 12.1.6 result formatting the 10-bit a/d conversion result can be supplied in two formats, left justified or right justified. the adfm bit of the adcon0 register controls the output format. figure 12-4 shows the two output formats. figure 12-3: 10-bit a/d conv ersion result format 12.2 adc operation 12.2.1 starting a conversion to enable the adc module, the adon bit of the adcon0 register must be set to a ? 1 ?. setting the go/ done bit of the adcon0 register to a ? 1 ? will start the analog-to-digital conversion. 12.2.2 completion of a conversion when the conversion is complete, the adc module will: ? clear the go/done bit ? set the adif flag bit ? update the adresh:adresl registers with new conversion result 12.2.3 terminating a conversion if a conversion must be terminated before completion, the go/done bit can be cleared in software. the adresh:adresl registers will not be updated with the partially complete analog-to-digital conversion sample. instead, the adresh:adresl register pair will retain the value of the previous conversion. addi- tionally, a 2 t ad delay is required before another acqui- sition can be initiated. following this delay, an input acquisition is automatically started on the selected channel. 12.2.4 adc operation during sleep the adc module can operate during sleep. this requires the adc clock source to be set to the f rc option. when the f rc clock source is selected, the adc waits one additional instruction before starting the conversion. this allows the sleep instruction to be executed, which can reduce system noise during the conversion. if the adc interrupt is enabled, the device will wake-up from sleep when the conversion completes. if the adc interrupt is disabled, the adc module is turned off after the conversion completes, although the adon bit remains set. when the adc clock source is something other than f rc , a sleep instruction causes the present conversion to be aborted and the adc module is turned off, although the adon bit remains set. 12.2.5 special event trigger the ccp special event trigger allows periodic adc measurements without software intervention. when this trigger occurs, the go/done bit is set by hardware and the timer1 counter resets to zero. using the special event trigger does not assure proper adc timing. it is the user?s responsibility to ensure that the adc timing requirements are met. see section 10.0 ?capture/compare/pwm modules? for more information. adresh adresl (adfm = 0 )msb lsb bit 7 bit 0 bit 7 bit 0 10-bit a/d result unimplemented: read as ? 0 ? (adfm = 1 ) msb lsb bit 7 bit 0 bit 7 bit 0 unimplemented: read as ? 0 ? 10-bit a/d result note: the go/done bit should not be set in the same instruction that turns on the adc. refer to section 12.2.6 ?a/d conver- sion procedure? . note: a device reset forces all registers to their reset state. thus, the adc module is turned off and any pending conversion is terminated.
? 2011 microchip technology inc. preliminary ds41576b-page 105 pic12f752/hv752 12.2.6 a/d conversion procedure this is an example procedure for using the adc to perform an analog-to-digital conversion: 1. configure port: ? disable pin output driver (see tris register) ? configure pin as analog 2. configure the adc module: ? select adc conversion clock ? configure voltage reference ? select adc input channel ? select result format ? turn on adc module 3. configure adc interrupt (optional): ? clear adc interrupt flag ? enable adc interrupt ? enable peripheral interrupt ? enable global interrupt (1) 4. wait the required acquisition time (2) . 5. start conversion by setting the go/done bit. 6. wait for adc conversion to complete by one of the following: ? polling the go/done bit ? waiting for the adc interrupt (interrupts enabled) 7. read adc result 8. clear the adc interrupt flag (required if interrupt is enabled). example 12-1: a/d conversion note 1: the global interrupt can be disabled if the user is attempting to wake-up from sleep and resume in-line code execution. 2: see section 12.4 ?a/d acquisition requirements? . ;this code block configures the adc ;for polling, vdd reference, frc clock ;and ra0 input. ; ;conversion start & polling for completion ; are included. ; banksel trisa ; bsf trisa,0 ;set ra0 to input banksel adcon1 ; movlw b?01110000? ;adc frc clock, iorwf adcon1 ; and ra0 as analog banksel adcon0 ; movlw b?10000001? ;right justify, movwf adcon0 ;vdd vref, an0, on call sampletime ;acquisiton delay bsf adcon0,go ;start conversion test again btfsc adcon0,go ;is conversion done? goto test again ;no, test again banksel adresh ; movf adresh,w ;read upper 2 bits movwf resulthi ;store in gpr space banksel adresl ; movf adresl,w ;read lower 8 bits movwf resultlo ;store in gpr space
pic12f752/hv752 ds41576b-page 106 preliminary ? 2011 microchip technology inc. 12.3 adc control registers register 12-1: adcon0: a/ d control register 0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adfm vcfg chs<3:0> go/done adon bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7 adfm: a/d conversion result format select bit 1 = right justified 0 = left justified bit 6 vcfg: voltage reference bit 1 = v ref pin 0 = v dd bit 5-2 chs<3:0>: analog channel select bits 0000 = channel 00 (an0) 0001 = channel 01 (an1) 0010 = channel 02 (an2) 0011 = channel 03 (an3) 0100 = reserved. do not use. ? ? ? 1101 = reserved. do not use. 1110 = digital-to-analog converter (dac output) 1111 = fixed voltage reference (fvr) bit 1 go/done : a/d conversion status bit 1 = a/d conversion cycle in progress. setting this bit starts an a/d conversion cycle. this bit is automatically cleared by hardware when the a/d conversion has completed. 0 = a/d conversion completed/not in progress bit 0 adon: adc enable bit 1 = adc is enabled 0 = adc is disabled and consumes no operating current
? 2011 microchip technology inc. preliminary ds41576b-page 107 pic12f752/hv752 register 12-2: adcon1: a/ d control register 1 u-0 r/w-0/0 r/w-0/0 r/w-0/0 u-0 u-0 u-0 u-0 ? adcs<2:0> ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented: read as ? 0 ? bit 6-4 adcs<2:0>: a/d conversion clock select bits 000 =f osc /2 001 =f osc /8 010 =f osc /32 011 =f rc (clock supplied from an internal oscillator with a divisor of 16) 100 =f osc /4 101 =f osc /16 110 =f osc /64 bit 3-0 unimplemented: read as ? 0 ?
pic12f752/hv752 ds41576b-page 108 preliminary ? 2011 microchip technology inc. register 12-3: adresh: adc result register high (adresh) adfm = 0 (read-only) r-x r-x r-x r-x r-x r-x r-x r-x adres<9:2> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-0 adres<9:2> : adc result register bits upper 8 bits of 10-bit conversion result register 12-4: adresl: adc result register low (adresl) adfm = 0 (read-only) r-x r-x u-0 u-0 u-0 u-0 u-0 u-0 adres<1:0> ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-6 adres<1:0> : adc result register bits lower 2 bits of 10-bit conversion result bit 5-0 unimplemented: read as ? 0 ? register 12-5: adresh: adc result register high (adresh) adfm = 1 (read-only) u-0 u-0 u-0 u-0 u-0 u-0 r-x r-x ? ? ? ? ? ? adres<9:8> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-2 unimplemented: read as ? 0 ? bit 1-0 adres<9:8> : adc result register bits upper 2 bits of 10-bit conversion result register 12-6: adresl: adc result register low (adresl) adfm = 1 (read-only) r-x r-x r-x r-x r-x r-x r-x r-x adres<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-0 adres<7:0> : adc result register bits lower 8 bits of 10-bit conversion result
? 2011 microchip technology inc. preliminary ds41576b-page 109 pic12f752/hv752 12.4 a/d acquisition requirements for the adc to meet its specified accuracy, the charge holding capacitor (c hold ) must be allowed to fully charge to the input channel voltage level. the analog input model is shown in figure 12-4 . the source impedance (r s ) and the internal sampling switch (r ss ) impedance directly affect the time required to charge the capacitor c hold . the sampling switch (r ss ) impedance varies over the device voltage (v dd ), see figure 12-4 . the maximum recommended impedance for analog sources is 10 k ? . as the source impedance is decreased, the acquisition time may be decreased. after the analog input channel is selected (or changed), an a/d acquisition must be done before the conversion can be started. to calculate the minimum acquisition time, equation 12-1 may be used. this equation assumes that 1/2 lsb error is used (1024 steps for the adc). the 1/2 lsb error is the maximum error allowed for the adc to meet its specified resolution. equation 12-1: acquisition time example t acq amplifier settling time hold capacitor charging time temperature coefficient ++ = t amp t c t coff ++ = 2s t c temperature - 25c ?? 0.05s/c ?? ?? ++ = t c c hold r ic r ss r s ++ ?? ln(1/2047) ? = 10pf 1k ? 7k ? 10k ? ++ ?? ? ln(0.0004885) = 1.37 = s t acq 2s 1.37s 50c- 25c ?? 0.05s/c ?? ?? ++ = 4.67 s = v applied 1e tc ? rc --------- ? ?? ?? ?? v applied 1 1 2047 ----------- - ? ?? ?? = v applied 1 1 2047 ----------- - ? ?? ?? v chold = v applied 1e t c ? rc --------- - ? ?? ?? ?? v chold = ;[1] v chold charged to within 1/2 lsb ;[2] v chold charge response to v applied ;combining [1] and [2] the value for t c can be approximated with the following equations: solving for t c : therefore: temperature 50c and external impedance of 10k ? 5.0v v dd = assumptions: note 1: the reference voltage (v ref ) has no effect on the equation, since it cancels itself out. 2: the charge holding capacitor (c hold ) is not discharged after each conversion. 3: the maximum recommended impedance for analog sources is 10 k ? . this is required to meet the pin leakage specification.
pic12f752/hv752 ds41576b-page 110 preliminary ? 2011 microchip technology inc. figure 12-4: analog input model figure 12-5: adc transfer function cpin va rs anx 5 pf v dd vt = 0.6v vt = 0.6v i leakage ric 1k sampling switch ss rss chold = 10 pf vss/v ref - 6v sampling switch 5v 4v 3v 2v 567891011 (kw) v dd 500 na legend: cpin vt i leakage ric ss chold = input capacitance = threshold voltage = leakage current at the pin due to = interconnect resistance = sampling switch = sample/hold capacitance various junctions rss 3ffh 3feh adc output code 3fdh 3fch 004h 003h 002h 001h 000h full-scale 3fbh 1 lsb ideal v ss /v ref - zero-scale transition v dd /v ref + transition 1 lsb ideal full-scale range analog input voltage
? 2011 microchip technology inc. preliminary ds41576b-page 111 pic12f752/hv752 table 12-2: summary of associated adc registers name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page adcon0 adfm vcfg chs<3:0> go/done adon 106 adcon1 ?adcs<2:0> ? ? ? ? 107 ansela ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 50 adresh (2) a/d result register high byte 108 * adresl (2) a/d result register low byte 106 * porta ? ? ra5 ra4 ra3 ra2 ra1 ra0 48 intcon gie peie t0ie inte iocie t0if intf iocif 20 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 21 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 23 trisa ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 48 legend: x = unknown, u = unchanged, ? = unimplemented read as ? 0 ?. shaded cells are not used for adc module. * page provides register information. note 1: trisa3 always reads ? 1 ?. 2: read-only register.
pic12f752/hv752 ds41576b-page 112 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 113 pic12f752/hv752 13.0 fixed voltage reference (fvr) the fixed voltage reference (fvr) is a stable voltage reference, independent of v dd , with 1.2v output level. the output of the fvr can be configured to supply a reference voltage to the following: ? adc input channel ? comparator 1 positive input (c1vp) ? comparator 2 positive input (c2vp) ?refout pin on the pic12f752, the fvr is enabled by setting the fvren bit of the fvrcon register. the fvr is always enabled on the pic12hv752 device. 13.1 fixed voltage reference output the fvr output can be applied to the refout pin by setting the fvrbufss and fvrbufen bits of the fvrcon register. the fvrbufss bit selects either the fvr or dac output reference to the refout pin buffer. the fvrbufen bit enables the output buffer to the refout pin. enabling the refout pin automatically overrides any digital input or output functions of the pin. reading the refout pin when it has been configured for a refer- ence voltage output will always return a ? 0 ?. 13.2 fvr stabilization period when the fixed voltage reference module is enabled, it requires time for the reference circuit to stabilize. once the circuit stabilizes and is ready for use, the fvrrdy bit of the fvrcon register will be set. see section 20.0 ?electrical specifications? for the minimum delay requirement. 13.3 operation during sleep when the device wakes up from sleep through an inter- rupt or a watchdog timer time-out, the contents of the fvrcon register are not affected. to minimize current consumption in sleep mode, fvr the voltage reference should be disabled. 13.4 effects of a reset a device reset clears the fvrcon register. as a result: ? the fvr module is disabled. ? the fvr voltage output is disabled on the refout pin. figure 13-1: voltage reference block diagram v ref+ v dd refout dacout fvr_ref dac_ref 0 1 fvrbufss dacoe fvrbufen x1 fvren 12hv752 + 1.2v - ref rdy fvrrdy fvr_ref v ss en v dd dac_ref dacen dacr<4:0> dacpss dac en dacrng vss pic12hv752 only 5v shunt regulator to adc, comparators c1 and c2. to adc, comparators c1 and c2.
pic12f752/hv752 ds41576b-page 114 preliminary ? 2011 microchip technology inc. 13.5 fvr control registers table 13-1: summary of registers associated with fixed voltage reference register 13-1: fvrcon: fixed voltage reference control register r/w-0/0 r-q/q r/w-0/0 r/w-0/0 u-0 u-0 u-0 u-0 fvren fvrrdy fvrbufen fvrbufss ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 fvren: fixed voltage reference enable bit 0 = fixed voltage reference is disabled 1 = fixed voltage reference is enabled bit 6 fvrrdy: fixed voltage reference ready flag bit 0 = fixed voltage reference output is not ready or not enabled bit 1 = fixed voltage reference output is ready for use bit 5 fvrbufen: voltage reference output pin buffer enable 0 = output buffer is disabled 1 = output buffer is enabled bit 4 fvrbufss: voltage reference pin buffer source select bit 0 = bandgap (1.2v) is the input to the output voltage buffer 1 = dac_out is the input to the output voltage buffer bit 3-0 unimplemented: read as ? 0 ? name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page fvrcon fvren fvrrdy fvrbufen fvrbufss ? ? ? ? 114 legend: shaded cells are not used with t he fixed voltage reference.
? 2011 microchip technology inc. preliminary ds41576b-page 115 pic12f752/hv752 14.0 digital-to-analog converter (dac) module the 5-bit, dual range digital-to-analog converter (dac) module supplies a variable voltage reference, with 64 selectable output levels of which 3 levels are duplicated. the output is ratiometric with respect to the input source, v src +. see figure 14-1 for a block diagram of the dac module. the input of the dac can be connected to two external voltage connections: ?v dd pin ?v ref + pin the output of the dac module provides a reference voltage to the following: ? comparator positive input ? adc input channel ? fvr input reference ?dacout pin the dac is enabled by setting the dacen bit of the daccon0 register. figure 14-1: digital-to-anal og converter block diagram r 2 (2) dacoe v ref + v dd dacpss r 2 (30) v src + dacen full range dacout r 1 (30) r 1 (16) r 1 (31) limited range r 1 (15) r 1 (0) dacrng 1 0 r 2 (31) 1 0 r 1 (1) r 2 (1) r 2 (0) dacr<4:0> 11111 11110 00010 00001 00000 11111 11110 10000 01111 00001 00000 5 dac_ref note: r 2 = 16*r 1 (to comparator, fvr fvr and adc modules)
pic12f752/hv752 ds41576b-page 116 preliminary ? 2011 microchip technology inc. 14.1 dac positive voltage source the dacpss bit of the daccon0 register selects the positive voltage source, v src +. the following voltage sources are available: ?v dd pin (default) ?v ref + pin dac module can select the positive voltage source using the dacpss bit of the daccon0 register. the default source, dacpss = 0 , connects v dd to the pos- itive voltage source (v src +). v src + can be changed to the v ref + pin by setting dacpss = 1 . 14.2 dac range selection the dacrng bit of the daccon0 register selects between full-range or limited-range dac output voltage. each range selects the output in 32 equal steps. in full-range mode, the output is (31/32)*vsrc+. in limited-range mode, the maximum v out is limited to 6% of vsrc+, (31/512) * v src +. 14.3 ratiometric output level the dac output value is derived using a resistor ladder with one end of the ladder tied to the positive voltage reference and the other end tied to v ss . if the voltage of the input source fluctuates, a similar fluctuation will result in the dac output value. the resistor values within the ladder can be found in section 20.0 ?electrical specifications? . 14.4 dac output voltage the dac output voltage level of the dac is determined by the dacrng and the dacr<4:0> bits of the daccon0 and daccon1 registers, respectively. use equation 14-1 to determine the value of the dac output voltage. example 14-1 illustrates the calculations of the minimum, maximum and increment size of the dac output voltage in full range mode. example 14-2 illustrates the limited range mode of the dac output voltage values. equation 14-1: dac output voltage example 14-1: full range mode example 14-2: limited range mode v out v src + ?? dacr 4:0 ?? 2 n ------------------------------ ?? ?? ?? ?? ?? ?? = note: the value of ?n? is determined by the dacrng bit. when: dacrng = 0 (limited range mode); n = 9; dacrng = 1 (full range mode); n = 5. given: v src = v dd = 5v, dacrng = 1 v out = [v src + * (dacr<4:0>/2 5 )] minimum v out calculation : maximum v out calculation : step increment calculation : dacr<4:0> = 0 0000b, (0d) ; dacr<4:0> = 1 1111b, (31d) ; dacr<4:0> = 0 0001b, (1d); v out = [5v * (0/32)] = 0v; v out = [5v * (31/32)] = 4.84v; v out = [5v * (1/32)] = 156 mv full range mode operation : 0v ?? v out ?? 4.84v, with 32-step increments of 156 mv. given: v src = v dd = 5v, dacrng = 0 v out = [v src + * (dacr<4:0>/2 9 )] minimum v out calculation : maximum v out calculation : step increment calculation : dacr<4:0> = 0 0000b, (0d) ; dacr<4:0> = 1 1111b, (31d) ; dacr<4:0> = 0 0001b, (1d); v out = [5v * (0/512)] = 0v; v out = [5v * (31/512)] = 303 mv; v out = [5v * (1/512)] = 9.8 mv limited range mode operation : 0v ?? v out ?? 303 mv, with 32-step increments of 9.8 mv.
? 2011 microchip technology inc. preliminary ds41576b-page 117 pic12f752/hv752 figure 14-2: voltage reference ou tput buffer example 14.5 dac voltage reference output the dac output (dac_ref) can be applied to the dacout pin as an unbuffered signal by: ? setting the dacoe bit of the daccon0 register ? clearing the fvrbufss bit of the fvrcon register. ? clearing the fvrbufen bit of the fvrcon register. figure 14-3 shows a block diagram pin configuration for the dac_ref and fvr_ref signals. this unbuffered dacout pin has limited current drive capability. when a higher drive current is required, an external buffer can be used on the dacout pin. figure 14-2 shows an example of buffering technique. the dac output can also be configured to use an inter- nal buffer by: ? setting the fvrbufen bit of the fvrcon regis- ter changing the pin configuration to be the refout pin. enabling the dacout pin automatically overrides any digital input or output functions of the pin. reading the dacout pin when it has been configured for dac ref- erence voltage output will always return a ? 0 ?. figure 14-3: dac/fvr output pin 14.6 operation during sleep when the device wakes up from sleep through an interrupt or a watchdog timer time-out, the contents of the daccon0 register are not affected. to minimize current consumption in sleep mode, the voltage reference should be disabled. 14.7 effects of a reset a device reset clears the daccon0 and daccon1 registers. as a result: ? the dac module is disabled. ? the dac voltage output is disabled on the dacout pin. dacout buffered dac output + ? dac module voltage reference output impedance r pic ? mcu refout dacout fvr_ref dac_ref 0 1 fvrbufss dacoe fvrbufen x1
pic12f752/hv752 ds41576b-page 118 preliminary ? 2011 microchip technology inc. 14.8 dac control registers register 14-1: daccon0: voltage re ference control register 0 r/w-0/0 r/w-0/0 r/w-0/0 u-0 u-0 r/w-0/0 u-0 u-0 dacen dacrng dacoe ? ? dacpss ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 dacen: dac enable bit 1 = dac is enabled 0 = dac is disabled bit 6 dacrng: dac range selection bit (1) 1 = dac is operating in full range mode 0 = dac is operating in limited range mode bit 5 dacoe: dac voltage output enable bit 1 = dac reference output is enabled to the dacout pin (2) 0 = dac reference output is disabled bit 4-3 unimplemented: read as ? 0 ? bit 2 dacpss: dac positive source select bits 0 =v dd 1 =v ref + pin bit 1-0 unimplemented: read as ? 0 ? note 1: refer to equation 14-1 . 2: the dacout pin configuration requires additional control bits in the fvrcon register (see figure 14-3 ). register 14-2: daccon1: voltage re ference control register 1 u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? dacr<4:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-5 unimplemented: read as ? 0 ? bit 4-0 dacr<4:0>: dac voltage output select bits 1 1111 = dac voltage maximum output ?? ? ? 0 0000 = dac voltage minimum output note 1: refer to equation 14-1 to calculate the value of the dac voltage output.
? 2011 microchip technology inc. preliminary ds41576b-page 119 pic12f752/hv752 table 14-1: summary of registers associated with the dac module name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page daccon0 dacen dacrng dacoe ? ?dacpss ? ? 118 daccon1 ? ? ? dacr<4:0> 118 fvrcon fvren fvrrdy fvrbufen fvrbufss ? ? ? ? 114 legend: ? = unimplemented, read as ? 0 ?. shaded cells are unused by the dac module.
pic12f752/hv752 ds41576b-page 120 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 121 pic12f752/hv752 15.0 comparator module comparators are used to interface analog circuits to a digital circuit by comparing two analog voltages and providing a digital indication of their relative magnitudes. comparators are very useful mixed signal building blocks because they provide analog functionality independent of program execution. the analog comparator module includes the following features: ? independent comparator control ? programmable input selection ? comparator output is available internally/externally ? programmable output polarity ? interrupt-on-change ? wake-up from sleep ? programmable speed/power optimization ?pwm shutdown ? programmable and fixed voltage reference 15.1 comparator overview a single comparator is shown in figure 15-1 along with the relationship between the analog input levels and the digital output. when the analog voltage at v in + is less than the analog voltage at v in -, the output of the comparator is a digital low level. when the analog voltage at v in + is greater than the analog voltage at v in -, the output of the comparator is a digital high level. figure 15-1: single comparator ? + v in + v in - output output v in + v in - note: the black areas of the output of the comparator represents the uncertainty due to input offsets and response time.
pic12f752/hv752 ds41576b-page 122 preliminary ? 2011 microchip technology inc. figure 15-2: comparator module simplified block diagram note 1: when cxon = 0 , the comparator will produce a ? 0 ? at the output. 2: when cxon = 0 , all multiplexer inputs are disconnected. mux cx 0 1 cxon (1) cxnch0 0 1 c x pch<1:0> c x in1- c x in+ mux - + cxvn cxvp c x out to c o g m o d u le q1 zlf c x pol mc x out set cxif 0 1 c x sync c x oe c x out dq syncc x out dac_ref fvr_ref c x in0- 2 cxsp cxhys det interrupt det interrupt cxintn cxintp to d a ta b u s 2 3 v ss tris bit cxon (2) (2) (from timer1) t1clk to timer1 0 1 d en q c x zlf
? 2011 microchip technology inc. preliminary ds41576b-page 123 pic12f752/hv752 15.2 comparator control each comparator has 2 control registers: cmxcon0 and cmxcon1. the cmxcon0 registers (see register 15-1 ) contain control and status bits for the following: ? enable ?output selection ? output pin enable ? output polarity ? speed/power selection ? hysteresis enable ? output synchronization the cmxcon1 registers (see register 15-2 ) contain control bits for the following: ? interrupt edge polarity (rising and/or falling) ? positive input channel selection ? negative input channel selection 15.2.1 comparator enable setting the cxon bit of the cmxcon0 register enables the comparator for operation. clearing the cxon bit disables the comparator resulting in minimum current consumption. 15.2.2 comparator output selection the output of the comparator can be monitored by reading either the cxout bit of the cmxcon0 register or the mcxout bit of the cmout register. in order to make the output available for an external connection, the following conditions must be true: ? cxoe bit of the cmxcon0 register must be set ? corresponding tris bit must be cleared ? cxon bit of the cmxcon0 register must be set 15.2.3 comparator output polarity inverting the output of the comparator is functionally equivalent to swapping the comparator inputs. the polarity of the comparator output can be inverted by setting the cxpol bit of the cmxcon0 register. clearing the cxpol bit results in a non-inverted output. table 15-1 shows the output state versus input conditions, including polarity control. 15.2.4 comparator speed/power selection the trade-off between speed or power can be opti- mized during program execution with the cxsp control bit. the default state for this bit is ? 1 ? which selects the normal speed mode. device power consumption can be optimized at the cost of slower comparator propaga- tion delay by clearing the cxsp bit to ? 0 ?. 15.3 comparator hysteresis a selectable amount of separation voltage can be added to the input pins of each comparator to provide a hysteresis function to the overall operation. hysteresis is enabled by setting the cxhys bit of the cmxcon0 register. see section 20.0 ?electrical specifications? for more information. 15.4 timer1 gate operation the output resulting from a comparator operation can be used as a source for gate control of timer1. see section 7.5 ?timer1 gate? for more information. this feature is useful for timing the duration or interval of an analog event. it is recommended that the comparator output be syn- chronized to timer1. this ensures that timer1 does not increment while a change in the comparator is occur- ring. note 1: the cxoe bit of the cmxcon0 register overrides the port data latch. setting the cxon bit of the cmxcon0 register has no impact on the port override. 2: the internal output of the comparator is latched with each instruction cycle. unless otherwise specified, external outputs are not latched. table 15-1: comparator output state vs. input conditions input condition cxpol cxout cxv n > cxv p 00 cxv n < cxv p 01 cxv n > cxv p 11 cxv n < cxv p 10
pic12f752/hv752 ds41576b-page 124 preliminary ? 2011 microchip technology inc. 15.4.1 comparator output synchronization the output from either comparator, c1 or c2, can be synchronized with timer1 by setting the cxsync bit of the cmxcon0 register. once enabled, the comparator output is latched on the falling edge of the timer1 source clock. if a prescaler is used with timer1, the comparator output is latched after the prescaling function. to prevent a race condition, the comparator output is latched on the falling edge of the timer1 clock source and timer1 increments on the rising edge of its clock source. see the comparator block diagram ( figure 15-2 ) and the timer1 block diagram ( figure 7-1 ) for more information. 15.5 comparator interrupt an interrupt can be generated upon a change in the output value of the comparator for each comparator, a rising edge detector and a falling edge detector are present. when either edge detector is triggered and its associ- ated enable bit is set (cxintp and/or cxintn bits of the cmxcon1 register), the corresponding interrupt flag bit (cxif bit of the pir2 register) will be set. to enable the interrupt, you must set the following bits: ? cxon, cxpol and cxsp bits of the cmxcon0 register ? cxie bit of the pie2 register ? cxintp bit of the cmxcon1 register (for a rising edge detection) ? cxintn bit of the cmxcon1 register (for a falling edge detection) ? peie and gie bits of the intcon register the associated interrupt flag bit, cxif bit of the pir2 register, must be cleared in software. if another edge is detected while this flag is being cleared, the flag will still be set at the end of the sequence. 15.6 comparator positive input selection configuring the cxpch<1:0> bits of the cmxcon1 register directs an internal voltage reference or an analog pin to the non-inverting input of the comparator: ? cxin0+ analog pin ? dac reference voltage (dac_ref) ? fvr reference voltage (fvr_ref) ?v ss (ground) see section 13.0 ?fixed voltage reference (fvr)? for more information on the fixed voltage reference module. see section 14.0 ?digital-to-analog converter (dac) module? for more information on the dac input signal. any time the comparator is disabled (cxon = 0 ), all comparator inputs are disabled. 15.7 comparator negative input selection the cxnch0 bit of the cmxcon0 register selects the analog input pin to the comparator inverting input. 15.8 comparator response time the comparator output is indeterminate for a period of time after the change of an input source or the selection of a new reference voltage. this period is referred to as the response time. the response time of the comparator differs from the settling time of the voltage reference. therefore, both of these times must be considered when determining the total response time to a comparator input change. see the comparator and voltage refer- ence specifications in section 20.0 ?electrical specifi- cations? for more details. 15.9 interaction with the cog module the comparator outputs can be brought to the cog module in order to facilitate auto-shutdown. if auto- restart is also enabled, the comparators can be configured as a closed loop analog feedback to the cog, thereby creating an analog controlled pwm. note: although a comparator is disabled, an interrupt can be generated by changing the output polarity with the cxpol bit of the cmxcon0 register, or by switching the comparator on or off with the cxon bit of the cmxcon0 register. note: to use cxin0+ and cxin1x- pins as ana- log input, the appropriate bits must be set in the ansel register and the corre- sponding tris bits must also be set to disable the output drivers.
? 2011 microchip technology inc. preliminary ds41576b-page 125 pic12f752/hv752 15.10 zero latency filter in high-speed operation, and under proper circuit conditions, it is possible for the comparator output to oscillate. this oscillation can have adverse effects on the hardware and software relying on this signal. therefore, a digital filter has been added to the comparator output to suppress the comparator output oscillation. once the comparator output changes, the output is prevented from reversing the change for a nominal time of 20 ns. this allows the comparator output to stabilize without affecting other dependent devices. refer to figure 15-3 . figure 15-3: comparator zero latency filter operation cxout from comparator cxout from zlf t zlf output waiting for t zlf to expire before an output change is allowed t zlf has expired so output change of zlf is immediate based on comparator output change
pic12f752/hv752 ds41576b-page 126 preliminary ? 2011 microchip technology inc. 15.11 analog input connection considerations a simplified circuit for an analog input is shown in figure 15-4 . since the analog input pins share their connection with a digital input, they have reverse biased esd protection diodes to v dd and v ss . the analog input, therefore, must be between v ss and v dd . if the input voltage deviates from this range by more than 0.6v in either direction, one of the diodes is for- ward biased and a latch-up may occur. a maximum source impedance of 10 k ? is recommended for the analog sources. also, any external component connected to an analog input pin, such as a capacitor or a zener diode, should have very little leakage current to minimize inaccuracies introduced. figure 15-4: analog input model note 1: when reading a port register, all pins configured as analog inputs will read as a ? 0 ?. pins configured as digital inputs will convert as an analog input, according to the input specification. 2: analog levels on any pin defined as a digital input, may cause the input buffer to consume more current than is specified. v a rs < 10k c pin 5 pf v dd v t ? 0.6v v t ? 0.6v r ic i leakage (1) vss legend: c pin = input capacitance i leakage = leakage current at the pin due to various junctions r ic = interconnect resistance r s = source impedance v a = analog voltage v t = threshold voltage to comparator note 1: see section 20.0 ?electrical specifications? analog input pin
? 2011 microchip technology inc. preliminary ds41576b-page 127 pic12f752/hv752 15.12 comparator control registers register 15-1: cmxcon0: comparator cx control register 0 r/w-0/0 r-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-1/1 r/w-0/0 r/w-0/0 cxon cxout cxoe cxpol cxzlf cxsp cxhys cxsync bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 cxon: comparator enable bit 1 = comparator is enabled 0 = comparator is disabled and consumes no active power bit 6 cxout: comparator output bit if cxpol = 1 (inverted polarity): 1 = cxvp < cxvn 0 = cxvp > cxvn if cxpol = 0 (non-inverted polarity): 1 = cxvp > cxvn 0 = cxvp < cxvn bit 5 cxoe: comparator output enable bit 1 = cxout is present on the cxout pin. requires that the associated tris bit be cleared to actually drive the pin. not affected by cxon. 0 = cxout is internal only bit 4 cxpol: comparator output polarity select bit 1 = comparator output is inverted 0 = comparator output is not inverted bit 3 cxzlf: zero latency filter enable bit 1 = zero latency filter is enabled 0 = zero latency filter is disabled bit 2 cxsp: comparator speed/power select bit 1 = comparator operates in normal power, higher speed mode 0 = comparator operates in low-power, low-speed mode bit 1 cxhys: comparator hysteresis enable bit 1 = comparator hysteresis enabled 0 = comparator hysteresis disabled bit 0 cxsync: comparator output synchronous mode bit 1 = comparator output to timer1 and i/o pin is synchronous to changes on timer1 clock source. output updated on the falling edge of timer1 clock source. 0 = comparator output to timer1 and i/o pin is asynchronous.
pic12f752/hv752 ds41576b-page 128 preliminary ? 2011 microchip technology inc. register 15-2: cmxcon1: comparator cx control register 1 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 u-0 u-0 u-0 r/w-0/0 cxintp cxintn cxpch<1:0> ? ? ? cxnch0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 cxintp: comparator interrupt on positive going edge enable bit 1 = the cxif interrupt flag will be set upon a positive going edge of the cxout bit 0 = no interrupt flag will be set on a positive going edge of the cxout bit bit 6 cxintn: comparator interrupt on negative going edge enable bits 1 = the cxif interrupt flag will be set upon a negative going edge of the cxout bit 0 = no interrupt flag will be set on a negative going edge of the cxout bit bit 5-4 cxpch<1:0>: comparator positive input channel select bits 00 = cxvp connects to cxin+ pin 01 = cxvp connects to dac voltage reference (dac_ref) 10 = cxvp connects to fvr voltage reference (fvr_ref) 11 = cxvp connects to v ss bit 3-1 unimplemented: read as ? 0 ? bit 0 cxnch0: comparator negative input channel select bits 0 = cxvn connects to c x in0- pin 1 = cxvn connects to c x in1- pin register 15-3: cmout: comparator output register u-0 u-0 u-0 u-0 u-0 u-0 r-0/0 r-0/0 ? ? ? ? ? ? mc2out mc1out bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-2 unimplemented: read as ? 0 ? bit 1 mc2out: mirror copy of c2out bit bit 0 mc1out: mirror copy of c1out bit
? 2011 microchip technology inc. preliminary ds41576b-page 129 pic12f752/hv752 table 15-2: summary of registers as sociated with co mparator module name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page cm1con0 c1on c1out c1oe c1pol c1zlf c1sp c1hys c1sync 127 cm1con1 c1intp c1intn c1pch<1:0> ? ? ? c1nch0 128 cm2con0 c2on c2out c2oe c2pol c2zlf c2sp c2hys c2sync 127 cm2con1 c2intp c2intn c2pch<1:0> ? ? ? c2nch0 128 cmout ? ? ? ? ? ? mcout2 mcout1 128 daccon0 dacen dacrng dacoe ? ? dacpss0 ? ? 118 daccon1 ? ? ? dacr<4:0> 118 fvrcon fvren fvrrdy fvr- bufen fvr- bufss ? ? ? ? 114 intcon gie peie t0ie inte iocie t0if intf iocif 20 pie2 ? ? c2ie c1ie ? cog1ie ? ccp1ie 22 pir2 ? ? c2if c1if ? cog1if ? ccp1if 24 trisa ? ? trisa5 trisa4 trisa3 (1) trisa2 trisa1 trisa0 48 ansela ? ? ansa5 ansa4 ? ansa2 ansa1 ansa0 50 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are unused by the comparator module. note 1: trisa3 always reads ? 1 ?.
pic12f752/hv752 ds41576b-page 130 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 131 pic12f752/hv752 16.0 instruction set summary the pic12f752/hv752 instruction set is highly orthog- onal and is comprised of three basic categories: ? byte-oriented operations ? bit-oriented operations ? literal and control operations each pic16 instruction is a 14-bit word divided into an opcode, which specifies the instruction type and one or more operands, which further specify the operation of the instruction. the formats for each of the categories is presented in figure 16-1 , while the various opcode fields are summarized in tab l e 1 6- 1 . table 16-2 lists the instructions recognized by the mpasm tm assembler. for byte-oriented instructions, ?f? represents a file register designator and ?d? represents a destination designator. the file register designator specifies which file register is to be used by the instruction. the destination designator specifies where the result of the operation is to be placed. if ?d? is zero, the result is placed in the w register. if ?d? is one, the result is placed in the file register specified in the instruction. for bit-oriented instructions, ?b? represents a bit field designator, which selects the bit affected by the operation, while ?f? represents the address of the file in which the bit is located. for literal and control operations, ?k? represents an 8-bit or 11-bit constant, or literal value. one instruction cycle consists of four oscillator periods; for an oscillator frequency of 4 mhz, this gives a normal instruction execution time of 1 ? s. all instructions are executed within a single instruction cycle, unless a conditional test is true, or the program counter is changed as a result of an instruction. when this occurs, the execution takes two instruction cycles, with the second cycle executed as a nop . all instruction examples use the format ? 0xhh ? to represent a hexadecimal number, where ? h ? signifies a hexadecimal digit. 16.1 read-modify-write operations any instruction that specifies a file register as part of the instruction performs a read-modify-write (rmw) operation. the register is read, the data is modified, and the result is stored according to either the instruc- tion or the destination designator ?d?. a read operation is performed on a register even if the instruction writes to that register. for example, a clrf porta instruction will read porta, clear all the data bits, then write the result back to porta. this example would have the unintended consequence of clearing the condition that set the iocif flag. table 16-1: opcode field descriptions figure 16-1: general format for instructions field description f register file address (0x00 to 0x7f) w working register (accumulator) b bit address within an 8-bit file register k literal field, constant data or label x don?t care location (= 0 or 1 ). the assembler will generate code with x = 0 . it is the recommended form of use for compatibility with all microchip software tools. d destination select; d = 0 : store result in w , d = 1 : store result in file register f. default is d = 1. pc program counter to time-out bit c carry bit dc digit carry bit z zero bit pd power-down bit byte-oriented file register operations 13 8 7 6 0 d = 0 for destination w opcode d f (file #) d = 1 for destination f f = 7-bit file register address bit-oriented file register operations 13 10 9 7 6 0 opcode b (bit #) f (file #) b = 3-bit bit address f = 7-bit file register address literal and control operations 13 8 7 0 opcode k (literal) k = 8-bit immediate value 13 11 10 0 opcode k (literal) k = 11-bit immediate value general call and goto instructions only
pic12f752/hv752 ds41576b-page 132 preliminary ? 2011 microchip technology inc. table 16-2: pic12f752/hv752 instruction set mnemonic, operands description cycles 14-bit opcode status affected notes msb lsb byte-oriented file register operations addwf andwf clrf clrw comf decf decfsz incf incfsz iorwf movf movwf nop rlf rrf subwf swapf xorwf f, d f, d f ? f, d f, d f, d f, d f, d f, d f, d f ? f, d f, d f, d f, d f, d add w and f and w with f clear f clear w complement f decrement f decrement f, skip if 0 increment f increment f, skip if 0 inclusive or w with f move f move w to f no operation rotate left f through carry rotate right f through carry subtract w from f swap nibbles in f exclusive or w with f 1 1 1 1 1 1 1 (2) 1 1 (2) 1 1 1 1 1 1 1 1 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0111 0101 0001 0001 1001 0011 1011 1010 1111 0100 1000 0000 0000 1101 1100 0010 1110 0110 dfff dfff lfff 0xxx dfff dfff dfff dfff dfff dfff dfff lfff 0xx0 dfff dfff dfff dfff dfff ffff ffff ffff xxxx ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff c, dc, z z z z z z z z z c c c, dc, z z 1, 2 1, 2 2 1, 2 1, 2 1, 2, 3 1, 2 1, 2, 3 1, 2 1, 2 1, 2 1, 2 1, 2 1, 2 1, 2 bit-oriented file register operations bcf bsf btfsc btfss f, b f, b f, b f, b bit clear f bit set f bit test f, skip if clear bit test f, skip if set 1 1 1 (2) 1 (2) 01 01 01 01 00bb 01bb 10bb 11bb bfff bfff bfff bfff ffff ffff ffff ffff 1, 2 1, 2 3 3 literal and control operations addlw andlw call clrwdt goto iorlw movlw retfie retlw return sleep sublw xorlw k k k ? k k k ? k ? ? k k add literal and w and literal with w call subroutine clear watchdog timer go to address inclusive or literal with w move literal to w return from interrupt return with literal in w return from subroutine go into standby mode subtract w from literal exclusive or literal with w 1 1 2 1 2 1 1 2 2 2 1 1 1 11 11 10 00 10 11 11 00 11 00 00 11 11 111x 1001 0kkk 0000 1kkk 1000 00xx 0000 01xx 0000 0000 110x 1010 kkkk kkkk kkkk 0110 kkkk kkkk kkkk 0000 kkkk 0000 0110 kkkk kkkk kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk c, dc, z z to , pd z to , pd c, dc, z z note 1: when an i/o register is modified as a function of itself (e.g., movf porta, 1 ), the value used will be that value present on the pins themselves. for example, if the data latch is ? 1 ? for a pin configured as input and is driven low by an external device, the data will be written back with a ? 0 ?. 2: if this instruction is executed on the tm r0 register (and where applicable, d = 1 ), the prescaler will be cleared if assigned to the timer0 module. 3: if the program counter (pc) is modified, or a conditional test is true, the instruction requires two cycles. the second cycle is executed as a nop .
? 2011 microchip technology inc. preliminary ds41576b-page 133 pic12f752/hv752 16.2 instruction descriptions addlw add literal and w syntax: [ label ] addlw k operands: 0 ? k ? 255 operation: (w) + k ? (w) status affected: c, dc, z description: the contents of the w register are added to the eight-bit literal ?k? and the result is placed in the w register. addwf add w and f syntax: [ label ] addwf f,d operands: 0 ? f ? 127 d ??? 0 , 1 ? operation: (w) + (f) ? (destination) status affected: c, dc, z description: add the contents of the w register with register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. andlw and literal with w syntax: [ label ] andlw k operands: 0 ? k ? 255 operation: (w) .and. (k) ? (w) status affected: z description: the contents of w register are and?ed with the eight-bit literal ?k?. the result is placed in the w register. andwf and w with f syntax: [ label ] andwf f,d operands: 0 ? f ? 127 d ??? 0 , 1 ? operation: (w) .and. (f) ? (destination) status affected: z description: and the w register with register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. bcf bit clear f syntax: [ label ] bcf f,b operands: 0 ? f ? 127 0 ? b ? 7 operation: 0 ? (f) status affected: none description: bit ?b? in register ?f? is cleared. bsf bit set f syntax: [ label ] bsf f,b operands: 0 ? f ? 127 0 ? b ? 7 operation: 1 ? (f) status affected: none description: bit ?b? in register ?f? is set. btfsc bit test f, skip if clear syntax: [ label ] btfsc f,b operands: 0 ? f ? 127 0 ? b ? 7 operation: skip if (f) = 0 status affected: none description: if bit ?b? in register ?f? is ? 1 ?, the next instruction is executed. if bit ?b? in register ?f? is ? 0 ?, the next instruction is discarded, and a nop is executed instead, making this a two-cycle instruction.
pic12f752/hv752 ds41576b-page 134 preliminary ? 2011 microchip technology inc. btfss bit test f, skip if set syntax: [ label ] btfss f,b operands: 0 ? f ? 127 0 ? b < 7 operation: skip if (f) = 1 status affected: none description: if bit ?b? in register ?f? is ? 0 ?, the next instruction is executed. if bit ?b? is ? 1 ?, then the next instruction is discarded and a nop is executed instead, making this a two-cycle instruction. call call subroutine syntax: [ label ] call k operands: 0 ? k ? 2047 operation: (pc)+ 1 ? tos, k ? pc<10:0>, (pclath<4:3>) ? pc<12:11> status affected: none description: call subroutine. first, return address (pc + 1) is pushed onto the stack. the eleven-bit immediate address is loaded into pc bits <10:0>. the upper bits of the pc are loaded from pclath. call is a two-cycle instruction. clrf clear f syntax: [ label ] clrf f operands: 0 ? f ? 127 operation: 00h ? (f) 1 ? z status affected: z description: the contents of register ?f? are cleared and the z bit is set. clrw clear w syntax: [ label ] clrw operands: none operation: 00h ? (w) 1 ? z status affected: z description: w register is cleared. zero bit (z) is set. clrwdt clear watchdog timer syntax: [ label ] clrwdt operands: none operation: 00h ? wdt 0 ? wdt prescaler, 1 ? to 1 ? pd status affected: to , pd description: clrwdt instruction resets the watchdog timer. it also resets the prescaler of the wdt. status bits to and pd are set. comf complement f syntax: [ label ] comf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f ) ? (destination) status affected: z description: the contents of register ?f? are complemented. if ?d? is ? 0 ?, the result is stored in w. if ?d? is ? 1 ?, the result is stored back in register ?f?. decf decrement f syntax: [ label ] decf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) - 1 ? (destination) status affected: z description: decrement register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?.
? 2011 microchip technology inc. preliminary ds41576b-page 135 pic12f752/hv752 decfsz decrement f, skip if 0 syntax: [ label ] decfsz f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) - 1 ? (destination); skip if result = 0 status affected: none description: the contents of register ?f? are decremented. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. if the result is ? 1 ?, the next instruction is executed. if the result is ? 0 ?, then a nop is executed instead, making it a two-cycle instruction. goto unconditional branch syntax: [ label ] goto k operands: 0 ? k ? 2047 operation: k ? pc<10:0> pclath<4:3> ? pc<12:11> status affected: none description: goto is an unconditional branch. the eleven-bit immediate value is loaded into pc bits <10:0>. the upper bits of pc are loaded from pclath<4:3>. goto is a two-cycle instruction. incf increment f syntax: [ label ] incf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) + 1 ? (destination) status affected: z description: the contents of register ?f? are incremented. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. incfsz increment f, skip if 0 syntax: [ label ] incfsz f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) + 1 ? (destination), skip if result = 0 status affected: none description: the contents of register ?f? are incremented. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. if the result is ? 1 ?, the next instruction is executed. if the result is ? 0 ?, a nop is executed instead, making it a two-cycle instruction. iorlw inclusive or literal with w syntax: [ label ] iorlw k operands: 0 ? k ? 255 operation: (w) .or. k ? (w) status affected: z description: the contents of the w register are or?ed with the eight-bit literal ?k?. the result is placed in the w register. iorwf inclusive or w with f syntax: [ label ] iorwf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (w) .or. (f) ? (destination) status affected: z description: inclusive or the w register with register ?f?. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?.
pic12f752/hv752 ds41576b-page 136 preliminary ? 2011 microchip technology inc. movf move f syntax: [ label ] movf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) ? (dest) status affected: z description: the contents of register ?f? is moved to a destination dependent upon the status of ?d?. if d = 0 , destination is w register. if d = 1 , the destination is file register ?f? itself. d = 1 is useful to test a file register since status flag z is affected. words: 1 cycles: 1 example: movf fsr, 0 after instruction w= value in fsr register z= 1 movlw move literal to w syntax: [ label ] movlw k operands: 0 ? k ? 255 operation: k ? (w) status affected: none description: the eight-bit literal ?k? is loaded into w register. the ?don?t cares? will assemble as ? 0 ?s. words: 1 cycles: 1 example: movlw 0x5a after instruction w= 0x5a movwf move w to f syntax: [ label ] movwf f operands: 0 ? f ? 127 operation: (w) ? (f) status affected: none description: move data from w register to register ?f?. words: 1 cycles: 1 example: movw f option before instruction option = 0xff w = 0x4f after instruction option = 0x4f w = 0x4f nop no operation syntax: [ label ] nop operands: none operation: no operation status affected: none description: no operation. words: 1 cycles: 1 example: nop
? 2011 microchip technology inc. preliminary ds41576b-page 137 pic12f752/hv752 retfie return from interrupt syntax: [ label ] retfie operands: none operation: tos ? pc, 1 ? gie status affected: none description: return from interrupt. stack is poped and top-of-stack (tos) is loaded in the pc. interrupts are enabled by setting global interrupt enable bit, gie (intcon<7>). this is a two-cycle instruction. words: 1 cycles: 2 example: retfie after interrupt pc = tos gie = 1 retlw return with literal in w syntax: [ label ] retlw k operands: 0 ? k ? 255 operation: k ? (w); tos ? pc status affected: none description: the w register is loaded with the eight-bit literal ?k?. the program counter is loaded from the top of the stack (the return address). this is a two-cycle instruction. words: 1 cycles: 2 example: table done call table;w contains ;table offset ;value goto done ? ? addwf pc ;w = offset retlw k1 ;begin table retlw k2 ; ? ? ? retlw kn ;end of table before instruction w = 0x07 after instruction w = value of k8 return return from subroutine syntax: [ label ] return operands: none operation: tos ? pc status affected: none description: return from subroutine. the stack is poped and the top of the stack (tos) is loaded into the program counter. this is a two-cycle instruction.
pic12f752/hv752 ds41576b-page 138 preliminary ? 2011 microchip technology inc. rlf rotate left f through carry syntax: [ label ] rlf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: see description below status affected: c description: the contents of register ?f? are rotated one bit to the left through the carry flag. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. words: 1 cycles: 1 example: rlf reg1,0 before instruction reg1 = 1110 0110 c=0 after instruction reg1 = 1110 0110 w = 1100 1100 c=1 rrf rotate right f through carry syntax: [ label ] rrf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: see description below status affected: c description: the contents of register ?f? are rotated one bit to the right through the carry flag. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. register f c register f c sleep enter sleep mode syntax: [ label ] sleep operands: none operation: 00h ? wdt, 0 ? wdt prescaler, 1 ? to , 0 ? pd status affected: to , pd description: the power-down status bit, pd is cleared. time-out status bit, to is set. watchdog timer and its prescaler are cleared. the processor is put into sleep mode with the oscillator stopped. sublw subtract w from literal syntax: [ label ] sublw k operands: 0 ?? k ?? 255 operation: k - (w) ??? w) status affected: c, dc, z description: the w register is subtracted (2?s complement method) from the eight-bit literal ?k?. the result is placed in the w register. result condition c = 0 w ? k c = 1 w ? k dc = 0 w<3:0> ? k<3:0> dc = 1 w<3:0> ? k<3:0>
? 2011 microchip technology inc. preliminary ds41576b-page 139 pic12f752/hv752 subwf subtract w from f syntax: [ label ] subwf f,d operands: 0 ?? f ?? 127 d ? [ 0 , 1 ] operation: (f) - (w) ??? destination) status affected: c, dc, z description: subtract (2?s complement method) w register from register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. swapf swap nibbles in f syntax: [ label ] swapf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f<3:0>) ? (destination<7:4>), (f<7:4>) ? (destination<3:0>) status affected: none description: the upper and lower nibbles of register ?f? are exchanged. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed in register ?f?. xorlw exclusive or literal with w syntax: [ label ] xorlw k operands: 0 ?? k ?? 255 operation: (w) .xor. k ??? w) status affected: z description: the contents of the w register are xor?ed with the eight-bit literal ?k?. the result is placed in the w register. c = 0 w ? f c = 1 w ? f dc = 0 w<3:0> ? f<3:0> dc = 1 w<3:0> ? f<3:0> xorwf exclusive or w with f syntax: [ label ] xorwf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (w) .xor. (f) ??? destination) status affected: z description: exclusive or the contents of the w register with register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?.
pic12f752/hv752 ds41576b-page 140 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 141 pic12f752/hv752 17.0 special features of the cpu the pic12f752/hv752 has a host of features intended to maximize system reliability, minimize cost through elimination of external components, provide power- saving features and offer code protection. these features are: ? reset - power-on reset (por) - power-up timer (pwrt) - brown-out reset (bor) ? interrupts ? watchdog timer (wdt) ? oscillator selection ? sleep ? code protection ? id locations ? in-circuit serial programming the power-up timer (pwrt), which provides a fixed delay of 64 ms (nominal) on power-up only, is designed to keep the part in reset while the power supply stabilizes. there is also circuitry to reset the device if a brown-out occurs, which can use the power-up timer to provide at least a 64 ms reset. with these functions- on-chip, most applications need no external reset circuitry. the sleep mode is designed to offer a very low-current power-down mode. the user can wake-up from sleep through: ? external reset ? watchdog timer wake-up ? an interrupt oscillator selection options are available to allow the part to fit the application. the intosc options save system cost, while the external clock (ec) option provides a means for specific frequency and accurate clock sources. configuration bits are used to select various options (see register 17-1 ). 17.1 configuration bits the configuration bits can be programmed (read as ? 0 ?), or left unprogrammed (read as ? 1 ?) to select various device configurations as shown in register 17-1 . these bits are mapped in program memory location 2007h. note: address 2007h is beyond the user program memory space. it belongs to the special configuration memory space (2000h- 3fffh), which can be accessed only during programming. see memory programming specification (ds41561) for more information.
pic12f752/hv752 ds41576b-page 142 preliminary ? 2011 microchip technology inc. register 17-1: co nfiguration word r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 debug clkouten wrt<1:0> boren<1:0> bit 13 bit 8 u-1 r/p-1 r/p-1 r/p-1 r/p-1 u-1 u-1 r/p-1 ? cp mclre pwrte wdte ? ? fosc0 bit 7 bit 0 legend: r = readable bit p = programmable bit u = unimplemented bit, read as ?1? ?0? = bit is cleared ?1? = bit is set -n = value when blank or after bulk erase bit 13 debug : debug mode enable bit (2) 1 = background debugger is disabled 0 = background debugger is enabled bit 12 clkouten : clock out enable bit 1 = clock out function disabled. clkout pin acts as i/o pin 0 = general purpose i/o disabled. clkout pin acts as clkout bit 11-10 wrt<1:0>: flash program memory self write enable bit 11 = write protection off 10 = 000h to ffh write-protected, 100h to 3ffh may be modified by pmcon1 control 01 = 000h to 1ffh write-protected, 200h to 3ffh may be modified by pmcon1 control 00 = 000h to 3ffh write-protected, entire program is write-protected bit 8-9 boren<1:0>: brown-out reset enable bits 11 = bor enabled 10 = bor enabled during operation and disabled in sleep 0x = bor disabled bit 7 unimplemented: read as ? 1 ?. bit 6 cp : code protection bit 1 = program memory code protection is disabled 0 = program memory code protection is enabled bit 5 mclre: mclr /v pp pin function select bit 1 = mclr pin is mclr function and weak internal pull-up is enabled 0 = mclr pin is input function, mclr function is internally disabled bit 4 pwrte : power-up timer enable bit (1) 1 = pwrt disabled 0 = pwrt enabled bit 3 wdte: watchdog timer enable bit 1 = wdt enabled 0 = wdt disabled bit 2-1 unimplemented: read as ? 1 ?. bit 0 fosc: oscillator selection bits 1 = ec oscillator selected: clkin on ra5/clkin 0 = internal oscillator: i/o function on ra5/clkin note 1: enabling brown-out reset does not automatically enable power-up timer. 2: the configuration bit is managed automatically by the device development tools. the user should not attempt to manually write this bit location. however, the user should ensure that this location has been programmed to a ? 1 ? and the device checksum is correct for proper operation of production software.
? 2011 microchip technology inc. preliminary ds41576b-page 143 pic12f752/hv752 17.2 calibration bits the 8 mhz internal oscillator is factory calibrated. these calibration values are stored in fuses located in the calibration word (2008h). the calibration word is not erased when using the specified bulk erase sequence in the memory programming specification (ds41561) and thus, does not require reprogramming. 17.3 reset the pic12f752/hv752 device differentiates between various kinds of reset: a) power-on reset (por) b) wdt reset during normal operation c) wdt reset during sleep d) mclr reset during normal operation e) mclr reset during sleep f) brown-out reset (bor) some registers are not affected in any reset condition; their status is unknown on por and unchanged in any other reset. most other registers are reset to a ?reset state? on: ? power-on reset ?mclr reset ?mclr reset during sleep ? wdt reset ? brown-out reset (bor) wdt wake-up does not cause register resets in the same manner as a wdt reset since wake-up is viewed as the resumption of normal operation. to and pd bits are set or cleared differently in different reset situations, as indicated in tab l e 1 7- 2 . software can use these bits to determine the nature of the reset. see table 17-4 for a full description of reset states of all registers. a simplified block diagram of the on-chip reset circuit is shown in figure 17-1 . the mclr reset path has a noise filter to detect and ignore small pulses. see section 20.0 ?electrical specifications? for pulse-width specifications. figure 17-1: simplified block di agram of on-chip reset circuit s rq external reset mclr /v pp pin v dd wdt module v dd rise detect on-chip wdt time-out power-on reset pwrt chip_reset 11-bit ripple counter reset enable pwrt sleep brown-out (1) reset boren note 1: refer to the configuration word register ( register 17-1 ). rc osc
pic12f752/hv752 ds41576b-page 144 preliminary ? 2011 microchip technology inc. table 17-1: time-out in various situations table 17-2: status/pcon bits and their significance oscillator configuration power-up brown-out reset wake-up from sleep pwrte = 0 pwrte = 1 pwrte = 0 pwrte = 1 ec, intosc t pwrt ?t pwrt ?? por bor to pd condition 0x11 power-on reset u011 brown-out reset uu0u wdt reset uu00 wdt wake-up uuuu mclr reset during normal operation uu10 mclr reset during sleep legend: u = unchanged, x = unknown
? 2011 microchip technology inc. preliminary ds41576b-page 145 pic12f752/hv752 17.3.1 power-on reset (por) the on-chip por circuit holds the chip in reset until v dd has reached a high enough level for proper operation. to take advantage of the por, simply connect the mclr pin through a resistor to v dd . this will eliminate external rc components usually needed to create power-on reset. a maximum rise time for v dd is required. see section 20.0 ?electrical specifications? for details. if the bor is enabled, the maximum rise time specification does not apply. the bor circuitry will keep the device in reset until v dd reaches v bor (see section 17.3.4 ?brown-out reset (bor)? ). when the device starts normal operation (exits the reset condition), device operating parameters (i.e., voltage, frequency, temperature, etc.) must be met to ensure proper operation. if these conditions are not met, the device must be held in reset until the operating conditions are met. for additional information, refer to application note an607, ?power-up trouble shooting? (ds00607). 17.3.2 mclr pic12f752/hv752 has a noise filter in the mclr reset path. the filter will detect and ignore small pulses. it should be noted that a wdt reset does not drive mclr pin low. voltages applied to the mclr pin that exceed its specification can result in both mclr resets and excessive current beyond the device specification during the esd event. for this reason, microchip recommends that the mclr pin no longer be tied directly to v dd . the use of an rc network, as shown in figure 17-2 , is suggested. an internal mclr option is enabled by clearing the mclre bit in the configuration word register. when mclre = 0 , the reset signal to the chip is generated internally. when the mclre = 1 , the mclr pin becomes an external reset input. in this mode, the mclr pin has a weak pull-up to v dd . figure 17-2: recommended mclr circuit 17.3.3 power-up timer (pwrt) the power-up timer provides a fixed 64 ms (nominal) time-out on power-up only, from por or brown-out reset. the power-up timer operates from an internal rc oscillator. for more information, see section 4.2.2 ?internal clock mode? . the chip is kept in reset as long as pwrt is active. the pwrt delay allows the v dd to rise to an acceptable level. a configuration bit, pwrte , can disable (if set) or enable (if cleared or programmed) the power-up timer. the power-up timer should be enabled when brown-out reset is enabled, although it is not required. the power-up timer delay will vary from chip-to-chip due to: ?v dd variation ? temperature variation ? process variation see dc parameters for details ( section 20.0 ?electrical specifications? ). note: the por circuit does not produce an internal reset when v dd declines. to re- enable the por, v dd must reach vss for a minimum of 100 ? s. note: voltage spikes below v ss at the mclr pin, inducing currents greater than 80 ma, may cause latch-up. thus, a series resis- tor of 50-100 ? should be used when applying a ?low? level to the mclr pin, rather than pulling this pin directly to v ss . v dd pic ? mclr r1 1k ??? or greater) c1 0.1 ? f (optional, not critical) r2 100 ? ? needed with capacitor) sw1 (optional) mcu
pic12f752/hv752 ds41576b-page 146 preliminary ? 2011 microchip technology inc. 17.3.4 brown-out reset (bor) the boren<1:0> bits in the configuration word register select one of three bor modes. one mode has been added to allow control of the bor enable for lower current during sleep. by selecting boren<1:0> = 10 , the bor is automatically disabled in sleep to conserve power and enabled on wake-up. see register 17-1 for the configuration word definition. a brown-out occurs when v dd falls below v bor for greater than parameter t bor (see section 20.0 ?electrical specifications? ). the brown-out condition will reset the device. this will occur regardless of v dd slew rate. a brown-out reset may not occur if v dd falls below v bor for less than parameter t bor . on any reset (power-on, brown-out reset, watchdog timer, etc.), the chip will remain in reset until v dd rises above v bor (see figure 17-3 ). if enabled, the power- up timer will be invoked by the reset and keep the chip in reset an additional 64 ms. if v dd drops below v bor while the power-up timer is running, the chip will go back into a brown-out reset and the power-up timer will be re-initialized. once v dd rises above v bor , the power-up timer will execute a 64 ms reset. table 17-3 summarizes the registers associated with bor. figure 17-3: brown -out situations table 17-3: summary of registers as sociated with brown-out reset note: the power-up timer is enabled by the pwrte bit in the configuration word register. 64 ms(1) vbor v dd internal reset vbor v dd internal reset 64 ms(1) < 64 ms 64 ms(1) vbor vdd internal reset note 1: 64 ms delay only if pwrte bit is programmed to ? 0 ?. name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page pcon ? ? ? ? ? ?por bor 25 status irp rp1 rp0 to pd z dc c 18 legend: u = unchanged, x = unknown, ? = unimplemented bit, reads as ? 0 ?, q = value depends on condition. shaded cells are not used by bor. note 1: other (non power-up) resets include mclr reset and watchdog timer reset during normal operation.
? 2011 microchip technology inc. preliminary ds41576b-page 147 pic12f752/hv752 17.3.5 time-out sequence on power-up, the time-out sequence is as follows: ? pwrt time-out is invoked after por has expired. ? ost is activated after the pwrt time-out has expired. the total time-out will vary based on oscillator configuration and pwrte bit status. for example, in ec mode with pwrte bit erased (pwrt disabled), there will be no time-out at all. figure 17-4 , figure 17-5 and figure 17-6 depict time-out sequences. since the time-outs occur from the por pulse, if mclr is kept low long enough, the time-outs will expire. then, bringing mclr high will begin execution immediately (see figure 17-5 ). this is useful for testing purposes or to synchronize more than one pic12f752/hv752 device operating in parallel. table 17-5 shows the reset conditions for some special registers, while table 17-4 shows the reset conditions for all the registers. 17.3.6 power co ntrol (pcon) register the power control register pcon (address 8eh) has two status bits to indicate what type of reset occurred last. bit 0 is bor (brown-out). bor is unknown on power- on reset. it must then be set by the user and checked on subsequent resets to see if bor = 0 , indicating that a brown-out has occurred. the bor status bit is a ?don?t care? and is not necessarily predictable if the brown-out circuit is disabled (boren<1:0> = 00 in the configuration word register). bit 1 is por (power-on reset). it is a ? 0 ? on power-on reset and unaffected otherwise. the user must write a ? 1 ? to this bit following a power-on reset. on a subse- quent reset, if por is ? 0 ?, it will indicate that a power- on reset has occurred (i.e., v dd may have gone too low). for more information, see section 17.3.4 ?brown-out reset (bor)? . figure 17-4: time-out sequence on power-up (delayed mclr ): case 1 figure 17-5: time-out sequence on power-up (delayed mclr ): case 2 t pwrt t ioscst v dd mclr internal por pwrt time-out ost time-out internal reset v dd mclr internal por pwrt time-out ost time-out internal reset t pwrt t ioscst
pic12f752/hv752 ds41576b-page 148 preliminary ? 2011 microchip technology inc. figure 17-6: time-out sequ ence on power-up (mclr with v dd ) v dd mclr internal por pwrt time-out ost time-out internal reset t pwrt t ioscst
? 2011 microchip technology inc. preliminary ds41576b-page 149 pic12f752/hv752 table 17-4: initialization condition for registers register address power-on reset mclr reset wdt reset brown-out reset (1) wake-up from sleep through interrupt wake-up from sleep through wdt time-out w? xxxx xxxx uuuu uuuu uuuu uuuu indf 00h/80h/ 100h/180h xxxx xxxx xxxx xxxx uuuu uuuu tmr0 01h xxxx xxxx uuuu uuuu uuuu uuuu pcl 02h/82h/ 102h/182h 0000 0000 0000 0000 pc + 1 (3) status 03h/83h/ 103h/183h 0001 1xxx 000q quuu (4) uuuq quuu (4) fsr 04h/84h/ 104h/184h xxxx xxxx uuuu uuuu uuuu uuuu porta 05h --xx xxxx --uu uuuu --uu uuuu iocaf 08h --00 0000 --00 0000 --uu uuuu pclath 0ah/8ah/ 10ah/18ah ---0 0000 ---0 0000 ---u uuuu intcon 0bh/8bh/ 10bh/18bh 0000 0000 0000 0000 uuuu uuuu (2) pir1 0ch 00-- -0-0 00-- -0-0 uu-- -u-u (2) pir2 0dh --00 -0-0 --00 -0-0 --uu -u-u (2) tmr1l 0fh xxxx xxxx uuuu uuuu uuuu uuuu tmr1h 10h xxxx xxxx uuuu uuuu uuuu uuuu t1con 11h 0000 00-0 uuuu uu-u uuuu uu-u t1gcon 12h 0000 0x00 0000 0x00 uuuu uuuu ccpr1l (1) 13h xxxx xxxx uuuu uuuu uuuu uuuu ccpr1h (1) 14h xxxx xxxx uuuu uuuu uuuu uuuu ccp1con (1) 15h --00 0000 --00 0000 --uu uuuu adresl (1) 1ch xxxx xxxx uuuu uuuu uuuu uuuu adresh (1) 1dh xxxx xxxx uuuu uuuu uuuu uuuu adcon0 (1) 1eh 0000 0000 0000 0000 uuuu uuuu adcon1 (1) 1fh -000 ---- -000 ---- -uuu ---- option_reg 81h/181h 1111 1111 1111 1111 uuuu uuuu trisa 85h --11 1111 --11 1111 --uu uuuu iocap 88h --00 0000 --00 0000 --uu uuuu pie1 8ch 00-- -000 00-- -000 uu-- -uuu pie2 8dh --00 -0-0 --00 -0-0 --uu -u-u osccon 8fh --01 -00- --uu -uu- --uu -uu- fvrcon 90h 0000 ---- 0000 ---- uuuu ---- daccon0 91h 000- -0-- 000- -0-- uuu- -u-- daccon1 92h ---0 0000 ---0 0000 ---u uuuu cm2con0 9bh 0000 0100 0000 0100 uuuu uuuu legend: u = unchanged, x = unknown, ? = unimplemented bit, reads as ? 0 ?, q = value depends on condition. note 1: if v dd goes too low, power-on reset will be activated and registers will be affected differently. 2: one or more bits in intcon and/or pirx will be affected (to cause wake-up). 3: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). 4: see tab le 1 7- 5 for reset value for specific condition. 5: if reset was due to brown-out, then bit 0 = 0 . all other resets will cause bit 0 = u .
pic12f752/hv752 ds41576b-page 150 preliminary ? 2011 microchip technology inc. cm2con1 9ch 0000 ---0 0000 ---0 uuuu ---u cm1con0 9dh 0000 0100 0000 0100 uuuu uuuu cm1con1 9eh 0000 ---0 0000 ---0 uuuu ---u cmout 9fh ---- --00 ---- --00 ---- --uu lata 105h --xx -xxx --uu -uuu --uu -uuu iocan 108h --00 0000 --00 0000 --uu uuuu wpua 10ch --00 0000 --00 0000 --uu uuuu slrcon0 10dh ---- -0-0 ---- -0-0 ---- -u-u pcon 10fh ---- --qq ---- --uu (1, 5) ---- --uu tmr2 110h 0000 0000 0000 0000 uuuu uuuu pr2 111h 1111 1111 1111 1111 uuuu uuuu t2con 112h -000 0000 -000 0000 -uuu uuuu hltmr1 113h 0000 0000 0000 0000 uuuu uuuu hltpr1 114h 1111 1111 1111 1111 uuuu uuuu hlt1con0 115h -000 0000 -000 0000 -uuu uuuu hlt1con1 116h ---0 0000 ---0 0000 ---u uuuu ansela 185h --11 -111 --11 -111 --uu -uuu apfcon 188h ---0 -000 ---0 -000 ---u -uuu osctune 189h ---0 0000 ---u uuuu ---u uuuu pmcon1 18ch ---- -000 ---- -000 ---- -uuu pmcon2 18dh ---- ---- ---- ---- ---- ---- pmadrl 18eh 0000 0000 0000 0000 uuuu uuuu pmadrh 18fh ---- --00 ---- --00 ---- --uu pmdatl 190h 0000 0000 0000 0000 uuuu uuuu pmdath 191h --00 0000 --00 0000 --uu uuuu cog1ph 192h ---- xxxx ---- uuuu ---- uuuu cog1blk 193h xxxx xxxx uuuu uuuu uuuu uuuu cog1db 194h xxxx xxxx uuuu uuuu uuuu uuuu cog1con0 195h 0000 0000 0000 0000 uuuu uuuu cog1con1 196h --00 0000 --00 0000 --uu uuuu cog1asd 197h 0000 0000 0000 0000 uuuu uuuu table 17-4: initialization conditi on for registers (continued) register address power-on reset mclr reset wdt reset (continued) brown-out reset (1) wake-up from sleep through interrupt wake-up from sleep through wdt time-out (continued) legend: u = unchanged, x = unknown, ? = unimplemented bit, reads as ? 0 ?, q = value depends on condition. note 1: if v dd goes too low, power-on reset will be activated and registers will be affected differently. 2: one or more bits in intcon and/or pirx will be affected (to cause wake-up). 3: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). 4: see tab le 1 7- 5 for reset value for specific condition. 5: if reset was due to brown-out, then bit 0 = 0 . all other resets will cause bit 0 = u .
? 2011 microchip technology inc. preliminary ds41576b-page 151 pic12f752/hv752 table 17-5: initialization condition for special registers condition program counter status register pcon register power-on reset 000h 0001 1xxx ---- --0x mclr reset during normal operation 000h 000u uuuu ---- --uu mclr reset during sleep 000h 0001 0uuu ---- --uu wdt reset 000h 0000 uuuu ---- --uu wdt wake-up pc + 1 uuu0 0uuu ---- --uu brown-out reset 000h 0001 1uuu ---- --u0 interrupt wake-up from sleep pc + 1 (1) uuu1 0uuu ---- --uu legend: u = unchanged, x = unknown, ? = unimplemented bit, reads as ? 0 ?. note 1: when the wake-up is due to an interrupt and global interrupt enable bit, gie, is set, the pc is loaded with the interrupt vector (0004h) after execution of pc + 1.
pic12f752/hv752 ds41576b-page 152 preliminary ? 2011 microchip technology inc. 17.4 interrupts the pic12f752/hv752 has multiple sources of inter- rupt: ? external interrupt (int pin) ? interrupt-on-change (ioc) interrupts ? timer0 overflow interrupt ? timer1 overflow interrupt ? timer2 match interrupt ? hardware limit timer (hlt) interrupt ? comparator interrupt (c1/c2) ? adc interrupt ? complementary output generator (cog) ? ccp1 interrupt ? flash memory self write the interrupt control register (intcon) and peripheral interrupt request registers (pirx) record individual interrupt requests in flag bits. the intcon register also has individual and global interrupt enable bits. the global interrupt enable bit, gie of the intcon register, enables (if set) all unmasked interrupts, or disables (if cleared) all interrupts. individual interrupts can be disabled through their corresponding enable bits in the intcon register and piex registers. gie is cleared on reset. when an interrupt is serviced, the following actions occur automatically: ? the gie is cleared to disable any further interrupt. ? the return address is pushed onto the stack. ? the pc is loaded with 0004h. the return from interrupt instruction, retfie , exits the interrupt routine, as well as sets the gie bit, which re-enables unmasked interrupts. the following interrupt flags are contained in the intcon register: ? int pin interrupt ? interrupt-on-change (ioc) interrupts ? timer0 overflow interrupt the peripheral interrupt flags are contained in the pir1 and pir2 registers. the corresponding interrupt enable bit is contained in the pie1 and pie2 registers. the following interrupt flags are contained in the pir1 register: ? a/d interrupt ? comparator interrupt ? timer1 overflow interrupt ? timer2 match interrupt ? enhanced ccp interrupt for external interrupt events, such as the int pin or porta change interrupt, the interrupt latency will be three or four instruction cycles. the exact latency depends upon when the interrupt event occurs (see figure 17-8 ). the latency is the same for one or two- cycle instructions. once in the interrupt service routine, the source(s) of the interrupt can be determined by polling the interrupt flag bits. the interrupt flag bit(s) must be cleared in software before re-enabling interrupts to avoid multiple interrupt requests. for additional information on timer1, timer2, comparators, adc, enhanced ccp modules, refer to the respective peripheral section. 17.4.1 ra2/int interrupt the external interrupt on the ra2/int pin is edge- triggered; either on the rising edge if the intedg bit of the option register is set, or the falling edge, if the intedg bit is clear. when a valid edge appears on the ra2/int pin, the intf bit of the intcon register is set. this interrupt can be disabled by clearing the inte control bit of the intcon register. the intf bit must be cleared by software in the interrupt service routine before re-enabling this interrupt. the ra2/int interrupt can wake-up the processor from sleep, if the inte bit was set prior to going into sleep. see section 17.7 ?power-down mode (sleep)? for details on sleep and figure 17-10 for timing of wake-up from sleep through ra2/int interrupt. note 1: individual interrupt flag bits are set, regardless of the status of their corresponding mask bit or the gie bit. 2: when an instruction that clears the gie bit is executed, any interrupts that were pending for execution in the next cycle are ignored. the interrupts, which were ignored, are still pending to be serviced when the gie bit is set again. note: the ansel register must be initialized to configure an analog channel as a digital input. pins configured as analog inputs will read ? 0 ? and cannot generate an interrupt.
? 2011 microchip technology inc. preliminary ds41576b-page 153 pic12f752/hv752 17.4.2 timer0 interrupt an overflow (ffh ? 00h) in the tmr0 register will set the t0if bit of the intcon register. the interrupt can be enabled/disabled by setting/clearing t0ie bit of the intcon register. see section 6.0 ?timer0 module? for operation of the timer0 module. 17.4.3 porta interrupt-on-change an input change on porta sets the iocif bit of the intcon register. the interrupt can be enabled/ disabled by setting/clearing the iocie bit of the intcon register. plus, individual pins can be configured through the ioc register. figure 17-7: interrupt logic note: if a change on the i/o pin should occur when any porta operation is being executed, then the iocif interrupt flag may not get set. t0if t0ie intf inte iocif iocie interrupt to cpu wake-up (if in sleep mode) gie (tmr1if) pir1<0> pirn<7> pien<7> peie peripheral interrupts (tmr1if) pir1<0>
pic12f752/hv752 ds41576b-page 154 preliminary ? 2011 microchip technology inc. figure 17-8: int pin interrupt timing table 17-6: summary of registers associated with interrupts name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page intcon gie peie t0ie inte iocie t0if intf iocif 20 iocaf ? ? iocaf5 iocaf4 iocaf3 iocaf2 iocaf1 iocaf0 52 iocan ? ? iocan5 iocan4 iocan3 iocan2 iocan1 iocan0 52 iocap ? ? iocap5 iocap4 iocap3 iocap2 iocap1 iocap0 52 lata ? ?lata5lata4 ? lata2 lata1 lata0 48 pie1 tmr1gie adie ? ? ? hltmr1ie tmr2ie tmr1ie 21 pir1 tmr1gif adif ? ? ? hltmr1if tmr2if tmr1if 23 legend: x = unknown, u = unchanged, ? = unimplemented read as ? 0 ?, q = value depends upon condition. shaded cells are not used by the interrupt module. q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 clkin clkout int pin intf flag (intcon reg.) gie bit (intcon reg.) instruction flow pc instruction fetched instruction executed interrupt latency pc pc + 1 pc + 1 0004h 0005h inst (0004h) inst (0005h) dummy cycle inst (pc) inst (pc + 1) inst (pc ? 1) inst (0004h) dummy cycle inst (pc) ? note 1: intf flag is sampled here (every q1). 2: asynchronous interrupt latency = 3-4 t cy . synchronous latency = 3 t cy , where t cy = instruction cycle time. latency is the same whether inst (pc) is a single cycle or a 2-cycle instruction. 3: clkout is available only in intosc and rc oscillator modes. 4: for minimum width of int pulse, refer to ac specifications in section 20.0 ?electrical specifications? . 5: intf is enabled to be set any time during the q4-q1 cycles. (1) (2) (3) (4) (5) (1)
? 2011 microchip technology inc. preliminary ds41576b-page 155 pic12f752/hv752 17.5 context saving during interrupts during an interrupt, only the return pc value is saved on the stack. typically, users may wish to save key registers during an interrupt (e.g., w and status registers). this must be implemented in software. temporary holding registers w_temp and status_temp should be placed in the last 16 bytes of gpr (see figure 2-2 ). these 16 locations are common to all banks and do not require banking. this makes context save and restore operations simpler. the code shown in example 17-1 can be used to: ? store the w register ? store the status register ? execute the isr code ? restore the status (and bank select bit register) ? restore the w register example 17-1: saving status and w registers in ram 17.6 watchdog timer (wdt) the watchdog timer is a free running timer, using lfintosc oscillator as its clock source. the wdt is enabled by setting the wdte bit of the configuration word (default setting). when wdte is set, the lfintosc will always be enabled to provide a clock source to the wdt module. during normal operation, a wdt time-out generates a device reset. if the device is in sleep mode, a wdt time-out causes the device to wake-up and continue with normal operation. the wdt can be permanently disabled by programming the configuration bit, wdte, as clear ( section 17.1 ?configuration bits? ). 17.6.1 wdt period the wdt has a nominal time-out period of 18 ms (with no prescaler). the time-out periods vary with temperature, v dd and process variations from part to part (see dc specs). if longer time-out periods are desired, a prescaler with a division ratio of up to 1:128 can be assigned to the wdt under software control by writing to the option register. thus, time-out periods up to 2.3 seconds can be realized. the clrwdt and sleep instructions clear the wdt and the prescaler, if assigned to the wdt, and prevent it from timing out and generating a device reset. the to bit in the status register will be cleared upon a watchdog timer time-out. note: the pic12f752/hv752 does not require saving the pclath. however, if com- puted goto s are used in both the isr and the main code, the pclath must be saved and restored in the isr. movwf w_temp ;copy w to temp register swapf status,w ;swap status to be saved into w ;swaps are used because they do not affect the status bits movwf status_temp ;save status to bank zero status_temp register : :(isr) ;insert user code here : swapf status_temp,w ;swap status_temp register into w ;(sets bank to original state) movwf status ;move w into status register swapf w_temp,f ;swap w_temp swapf w_temp,w ;swap w_temp into w
pic12f752/hv752 ds41576b-page 156 preliminary ? 2011 microchip technology inc. 17.6.2 wdt programming considerations it should also be taken in account that under worst- case conditions (i.e., v dd = min., temperature = max., max. wdt prescaler) it may take several seconds before a wdt time-out occurs. figure 17-9: watchdog timer with shared prescale block diagram table 17-7: wdt status conditions wdt wdte = 0 cleared clrwdt command exit sleep t0cki t0se pin tmr0 watchdog timer wdt time-out ps<2:0> data bus set flag bit t0if on overflow t0cs note 1: t0se, t0cs, psa, ps<2:0> are bits in the option_reg register. 2: wdte bit is in the configuration word register. 0 1 0 1 0 1 8 8 8-bit prescaler 0 1 f osc /4 psa psa psa sync 2 t cy shared prescale wdte lfintosc ( figure 4-1 ) ?? 2 psa
? 2011 microchip technology inc. preliminary ds41576b-page 157 pic12f752/hv752 table 17-8: summary of registers associated with watchdog timer table 17-9: summary of configurat ion word with watchdog timer name bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0 register on page option_reg rapu intedg t0cs t0se psa ps<2:0> 57 legend: shaded cells are not used by the watchdog timer. note 1: see register 17-1 for operation of all configuration word register bits. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? debug clkouten wrt<1:0> boren<1:0> 142 7:0 ? cp mclre pwrte wdte ? ? fosc0 legend: ? = unimplemented location, read as ? 1 ?. shaded cells are not used by watchdog timer.
pic12f752/hv752 ds41576b-page 158 preliminary ? 2011 microchip technology inc. 17.7 power-down mode (sleep) the power-down mode is entered by executing a sleep instruction. if the watchdog timer is enabled: ? wdt will be cleared but keeps running. ?pd bit in the status register is cleared. ?to bit is set. ? oscillator driver is turned off. ? i/o ports maintain the status they had before sleep was executed (driving high, low or high-impedance). for lowest current consumption in this mode, all i/o pins should be either at v dd or v ss , with no external circuitry drawing current from the i/o pin and the comparators, dac and fvr should be disabled. i/o pins that are high- impedance inputs should be pulled high or low externally to avoid switching currents caused by floating inputs. the t0cki input should also be at v dd or v ss for lowest current consumption. the contribution from on-chip pull- ups on porta should be considered. the mclr pin must be at a logic high level. 17.7.1 wake-up from sleep the device can wake-up from sleep through one of the following events: 1. external reset input on mclr pin. 2. watchdog timer wake-up. 3. interrupt from int pin. 4. interrupt-on-change input change. 5. peripheral interrupt. the first event will cause a device reset. the other events are considered a continuation of program execution. the to and pd bits in the status register can be used to determine the cause of device reset. the pd bit, which is set on power-up, is cleared when sleep is invoked. to bit is cleared if wdt wake-up occurred. the following peripheral interrupts can wake the device from sleep: 1. timer1 interrupt. timer1 must be operating as an asynchronous counter. 2. ccp capture mode interrupt. 3. a/d conversion (when a/d clock source is rc). 4. comparator output changes state. 5. interrupt-on-change. 6. external interrupt from int pin. other peripherals cannot generate interrupts since during sleep, no on-chip clocks are present. when the sleep instruction is being executed, the next instruction (pc + 1) is prefetched. for the device to wake-up through an interrupt event, the corresponding interrupt enable bit must be set (enabled). wake-up is regardless of the state of the gie bit. if the gie bit is clear (disabled), the device continues execution at the instruction after the sleep instruction. if the gie bit is set (enabled), the device executes the instruction after the sleep instruction, then branches to the interrupt address (0004h). in cases where the execution of the instruction following sleep is not desirable, the user should have a nop after the sleep instruction. the wdt is cleared when the device wakes up from sleep, regardless of the source of wake-up. 17.7.2 wake-up using interrupts when global interrupts are disabled (gie cleared) and any interrupt source has both its interrupt enable bit and interrupt flag bit set, one of the following will occur: ? if the interrupt occurs before the execution of a sleep instruction, the sleep instruction will complete as a nop . therefore, the wdt and wdt prescaler and postscaler (if enabled) will not be cleared, the to bit will not be set and the pd bit will not be cleared. ? if the interrupt occurs during or after the execution of a sleep instruction, the device will immediately wake-up from sleep. the sleep instruction is executed. therefore, the wdt and wdt prescaler and postscaler (if enabled) will be cleared, the to bit will be set and the pd bit will be cleared. even if the flag bits were checked before executing a sleep instruction, it may be possible for flag bits to become set before the sleep instruction completes. to determine whether a sleep instruction executed, test the pd bit. if the pd bit is set, the sleep instruction was executed as a nop . to ensure that the wdt is cleared, a clrwdt instruction should be executed before a sleep instruction. see figure 17-10 for more details. note: it should be noted that a reset generated by a wdt time-out does not drive mclr pin low. note: if the global interrupts are disabled (gie is cleared) and any interrupt source has both its interrupt enable bit and the correspond- ing interrupt flag bits set, the device will immediately wake-up from sleep.
? 2011 microchip technology inc. preliminary ds41576b-page 159 pic12f752/hv752 figure 17-10: wake-up from sleep through interrupt 17.8 code protection if the code protection bit(s) have not been programmed, the on-chip program memory can be read out using icsp ? for verification purposes. 17.9 id locations four memory locations (2000h-2003h) are designated as id locations where the user can store checksum or other code identification numbers. these locations are not accessible during normal execution but are readable and writable during program/verify mode. only the least significant 7 bits of the id locations are reported when using mplab ? ide. q1 q2 q3 q4 q1 q2 q3 q4 q1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 clkin clkout int pin intf flag (intcon reg.) gie bit (intcon reg.) instruction flow pc instruction fetched instruction executed pc pc + 1 pc + 2 inst(pc) = sleep inst(pc ? 1) inst(pc + 1) sleep processor in sleep interrupt latency (3) inst(pc + 2) inst(pc + 1) inst(0004h) inst(0005h) inst(0004h) dummy cycle pc + 2 0004h 0005h dummy cycle t ioscst pc + 2 note 1: hfintosc oscillator mode assumed. 2: gie = ? 1 ? assumed. in this case after wake-up, the processor jumps to 0004h. if gie = ? 0 ?, execution will continue in-line. note: the entire flash program memory will be erased when the code protection is turned off. see the ? program memory specification? (ds41561) for more information.
pic12f752/hv752 ds41576b-page 160 preliminary ? 2011 microchip technology inc. 17.10 in-circuit serial programming? thepic12f752/hv752 microcontrollers can be serially programmed while in the end application circuit. this is simply done with five connections for: ?clock ?data ? power ? ground ? programming voltage this allows customers to manufacture boards with unprogrammed devices and then program the microcontroller just before shipping the product. this also allows the most recent firmware or a custom firmware to be programmed. the device is placed into a program/verify mode by holding the icspdat and icspclk pins low, while raising the mclr (v pp ) pin from v il to v ihh . see the memory programming specification (ds41561) for more information. icspdat becomes the programming data and icspclk becomes the programming clock. both icspdat and icspclk are schmitt trigger inputs in program/verify mode. a typical in-circuit serial programming connection is shown in figure 17-11 . figure 17-11: typical in-circuit serial programming connection note: to erase the device, v dd must be above the bulk erase v dd minimum given in the ?program memory specification? (ds41561) external connector signals to n o r m a l connections to n o r m a l connections pic12f752/hv752 v dd v ss mclr /v pp icspclk icspdat +5v 0v v pp clk data i/o * * * * * isolation devices (as required)
? 2011 microchip technology inc. preliminary ds41576b-page 161 pic12f752/hv752 18.0 shunt regulator (pic12hv752 only) the pic12hv752 devices include a permanent internal 5 volt (nominal) shunt regulator in parallel with the v dd pin. this eliminates the need for an external voltage regulator in systems sourced by an unregulated supply. all external devices connected directly to the v dd pin will share the regulated supply voltage and contribute to the total v dd supply current (i load ). 18.1 regulator operation a shunt regulator generates a specific supply voltage by creating a voltage drop across a pass resistor r ser . the voltage at the v dd pin of the microcontroller is monitored and compared to an internal voltage refer- ence. the current through the resistor is then adjusted, based on the result of the comparison, to produce a voltage drop equal to the difference between the supply voltage v unreg and the v dd of the microcontroller. see figure 18-1 for voltage regulator schematic. figure 18-1: shunt regulator an external current limiting resistor, r ser , located between the unregulated supply, v unreg , and the v dd pin, drops the difference in voltage between v unreg and v dd . r ser must be between r max and r min as defined by equation 18-1 . equation 18-1: r ser limiting resistor 18.2 regulator considerations the supply voltage v unreg and load current are not constant. therefore, the current range of the regulator is limited. selecting a value for r ser must take these three factors into consideration. since the regulator uses the band gap voltage as the regulated voltage reference, this voltage reference is permanently enabled in the pic12hv752 devices. the shunt regulator will still consume current when below operating voltage range for the shunt regulator. 18.3 design considerations for more information on using the shunt regulator and managing current load, see application note an1035, ? designing with hv microcontrollers? (ds01035). feedback v dd v ss c bypass r ser v unreg i supply i shunt i load device r max = (vu min - 5v) 1.05 ? (4 m a + i load ) r min = (vu max - 5v) 0.95 ? (50 m a) where: r max = maximum value of r ser (ohms) r min = minimum value of r ser (ohms) vu min = minimum value of v unreg vu max = maximum value of v unreg v dd = regulated voltage (5v nominal) i load = maximum expected load current in ma including i/o pin currents and external circuits connected to v dd . 1.05 = compensation for +5% tolerance of r ser 0.95 = compensation for -5% tolerance of r ser
pic12f752/hv752 ds41576b-page 162 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 163 pic12f752/hv752 19.0 development support the pic ? microcontrollers and dspic ? digital signal controllers are supported with a full range of software and hardware development tools: ? integrated development environment - mplab ? ide software ? compilers/assemblers/linkers - mplab c compiler for various device families - hi-tech c for various device families - mpasm tm assembler -mplink tm object linker/ mplib tm object librarian - mplab assembler/linker/librarian for various device families ? simulators - mplab sim software simulator ?emulators - mplab real ice? in-circuit emulator ? in-circuit debuggers - mplab icd 3 - pickit? 3 debug express ? device programmers - pickit? 2 programmer - mplab pm3 device programmer ? low-cost demonstration/development boards, evaluation kits, and starter kits 19.1 mplab integrated development environment software the mplab ide software brings an ease of software development previously unseen in the 8/16/32-bit microcontroller market. the mplab ide is a windows ? operating system-based application that contains: ? a single graphical interface to all debugging tools - simulator - programmer (sold separately) - in-circuit emulator (sold separately) - in-circuit debugger (sold separately) ? a full-featured editor with color-coded context ? a multiple project manager ? customizable data windows with direct edit of contents ? high-level source code debugging ? mouse over variable inspection ? drag and drop variables from source to watch windows ? extensive on-line help ? integration of select third party tools, such as iar c compilers the mplab ide allows you to: ? edit your source files (either c or assembly) ? one-touch compile or assemble, and download to emulator and simulator tools (automatically updates all project information) ? debug using: - source files (c or assembly) - mixed c and assembly - machine code mplab ide supports multiple debugging tools in a single development paradigm, from the cost-effective simulators, through low-cost in-circuit debuggers, to full-featured emulators. this eliminates the learning curve when upgrading to tools with increased flexibility and power.
pic12f752/hv752 ds41576b-page 164 preliminary ? 2011 microchip technology inc. 19.2 mplab c compilers for various device families the mplab c compiler code development systems are complete ansi c compilers for microchip?s pic18, pic24 and pic32 families of microcontrollers and the dspic30 and dspic33 families of digital signal control- lers. these compilers provide powerful integration capabilities, superior code optimization and ease of use. for easy source level debugging, the compilers provide symbol information that is optimized to the mplab ide debugger. 19.3 hi-tech c for various device families the hi-tech c compiler code development systems are complete ansi c compilers for microchip?s pic family of microcontrollers and the dspic family of digital signal controllers. these compilers provide powerful integration capabilities, omniscient code generation and ease of use. for easy source level debugging, the compilers provide symbol information that is optimized to the mplab ide debugger. the compilers include a macro assembler, linker, pre- processor, and one-step driver, and can run on multiple platforms. 19.4 mpasm assembler the mpasm assembler is a full-featured, universal macro assembler for pic10/12/16/18 mcus. the mpasm assembler generates relocatable object files for the mplink object linker, intel ? standard hex files, map files to detail memory usage and symbol reference, absolute lst files that contain source lines and generated machine code and coff files for debugging. the mpasm assembler features include: ? integration into mplab ide projects ? user-defined macros to streamline assembly code ? conditional assembly for multi-purpose source files ? directives that allow complete control over the assembly process 19.5 mplink object linker/ mplib object librarian the mplink object linker combines relocatable objects created by the mpasm assembler and the mplab c18 c compiler. it can link relocatable objects from precompiled libraries, using directives from a linker script. the mplib object librarian manages the creation and modification of library files of precompiled code. when a routine from a library is called from a source file, only the modules that contain that routine will be linked in with the application. this allows large libraries to be used efficiently in many different applications. the object linker/library features include: ? efficient linking of single libraries instead of many smaller files ? enhanced code maintainability by grouping related modules together ? flexible creation of libraries with easy module listing, replacement, deletion and extraction 19.6 mplab assembler, linker and librarian for various device families mplab assembler produces relocatable machine code from symbolic assembly language for pic24, pic32 and dspic devices. mplab c compiler uses the assembler to produce its object file. the assembler generates relocatable object files that can then be archived or linked with other relocatable object files and archives to create an executable file. notable features of the assembler include: ? support for the entire device instruction set ? support for fixed-point and floating-point data ? command line interface ? rich directive set ? flexible macro language ? mplab ide compatibility
? 2011 microchip technology inc. preliminary ds41576b-page 165 pic12f752/hv752 19.7 mplab sim software simulator the mplab sim software simulator allows code development in a pc-hosted environment by simulat- ing the pic mcus and dspic ? dscs on an instruction level. on any given instruction, the data areas can be examined or modified and stimuli can be applied from a comprehensive stimulus controller. registers can be logged to files for further run-time analysis. the trace buffer and logic analyzer display extend the power of the simulator to record and track program execution, actions on i/o, most peripherals and internal registers. the mplab sim software simulator fully supports symbolic debugging using the mplab c compilers, and the mpasm and mplab assemblers. the soft- ware simulator offers the flexibility to develop and debug code outside of the hardware laboratory envi- ronment, making it an excellent, economical software development tool. 19.8 mplab real ice in-circuit emulator system mplab real ice in-circuit emulator system is microchip?s next generation high-speed emulator for microchip flash dsc and mcu devices. it debugs and programs pic ? flash mcus and dspic ? flash dscs with the easy-to-use, powerful graphical user interface of the mplab integrated development environment (ide), included with each kit. the emulator is connected to the design engineer?s pc using a high-speed usb 2.0 interface and is connected to the target with either a connector compatible with in- circuit debugger systems (rj11) or with the new high- speed, noise tolerant, low-voltage differential signal (lvds) interconnection (cat5). the emulator is field upgradable through future firmware downloads in mplab ide. in upcoming releases of mplab ide, new devices will be supported, and new features will be added. mplab real ice offers significant advantages over competitive emulators including low-cost, full-speed emulation, run-time variable watches, trace analysis, complex breakpoints, a ruggedized probe interface and long (up to three meters) interconnection cables. 19.9 mplab icd 3 in-circuit debugger system mplab icd 3 in-circuit debugger system is micro- chip's most cost effective high-speed hardware debugger/programmer for microchip flash digital sig- nal controller (dsc) and microcontroller (mcu) devices. it debugs and programs pic ? flash microcon- trollers and dspic ? dscs with the powerful, yet easy- to-use graphical user interface of mplab integrated development environment (ide). the mplab icd 3 in-circuit debugger probe is con- nected to the design engineer's pc using a high-speed usb 2.0 interface and is connected to the target with a connector compatible with the mplab icd 2 or mplab real ice systems (rj-11). mplab icd 3 supports all mplab icd 2 headers. 19.10 pickit 3 in-circuit debugger/ programmer and pickit 3 debug express the mplab pickit 3 allows debugging and program- ming of pic ? and dspic ? flash microcontrollers at a most affordable price point using the powerful graphical user interface of the mplab integrated development environment (ide). the mplab pickit 3 is connected to the design engineer's pc using a full speed usb interface and can be connected to the target via an microchip debug (rj-11) connector (compatible with mplab icd 3 and mplab real ice). the connector uses two device i/o pins and the reset line to imple- ment in-circuit debugging and in-circuit serial pro- gramming?. the pickit 3 debug express include the pickit 3, demo board and microcontroller, hookup cables and cdrom with user?s guide, lessons, tutorial, compiler and mplab ide software.
pic12f752/hv752 ds41576b-page 166 preliminary ? 2011 microchip technology inc. 19.11 pickit 2 development programmer/debugger and pickit 2 debug express the pickit? 2 development programmer/debugger is a low-cost development tool with an easy to use inter- face for programming and debugging microchip?s flash families of microcontrollers. the full featured windows ? programming interface supports baseline (pic10f, pic12f5xx, pic16f5xx), midrange (pic12f6xx, pic16f), pic18f, pic24, dspic30, dspic33, and pic32 families of 8-bit, 16-bit, and 32-bit microcontrollers, and many microchip serial eeprom products. with microchip?s powerful mplab integrated development environment (ide) the pickit? 2 enables in-circuit debugging on most pic ? microcon- trollers. in-circuit-debugging runs, halts and single steps the program while the pic microcontroller is embedded in the application. when halted at a break- point, the file registers can be examined and modified. the pickit 2 debug express include the pickit 2, demo board and microcontroller, hookup cables and cdrom with user?s guide, lessons, tutorial, compiler and mplab ide software. 19.12 mplab pm3 device programmer the mplab pm3 device programmer is a universal, ce compliant device programmer with programmable voltage verification at v ddmin and v ddmax for maximum reliability. it features a large lcd display (128 x 64) for menus and error messages and a modu- lar, detachable socket assembly to support various package types. the icsp? cable assembly is included as a standard item. in stand-alone mode, the mplab pm3 device programmer can read, verify and program pic devices without a pc connection. it can also set code protection in this mode. the mplab pm3 connects to the host pc via an rs-232 or usb cable. the mplab pm3 has high-speed communications and optimized algorithms for quick programming of large memory devices and incorporates an mmc card for file storage and data applications. 19.13 demonstration/development boards, evaluation kits, and starter kits a wide variety of demonstration, development and evaluation boards for various pic mcus and dspic dscs allows quick application development on fully func- tional systems. most boards include prototyping areas for adding custom circuitry and provide application firmware and source code for examination and modification. the boards support a variety of features, including leds, temperature sensors, switches, speakers, rs-232 interfaces, lcd displays, potentiometers and additional eeprom memory. the demonstration and development boards can be used in teaching environments, for prototyping custom circuits and for learning about various microcontroller applications. in addition to the picdem? and dspicdem? demon- stration/development board series of circuits, microchip has a line of evaluation kits and demonstration software for analog filter design, k ee l oq ? security ics, can, irda ? , powersmart battery management, seeval ? evaluation system, sigma-delta adc, flow rate sensing, plus many more. also available are starter kits that contain everything needed to experience the specified device. this usually includes a single application and debug capability, all on one board. check the microchip web page ( www.microchip.com ) for the complete list of demonstration, development and evaluation kits.
? 2011 microchip technology inc. preliminary ds41576b-page 167 pic12f752/hv752 20.0 electrical specifications absolute maximum ratings (?) ambient temperature under bias................................................................................................. .........-40 to +125c storage temperature ............................................................................................................ ............ -65c to +150c voltage on v dd with respect to v ss ................................................................................................... -0.3v to +6.5v voltage on mclr with respect to vss ............................................................................................... -0.3v to +1 3.5v voltage on all other pins with respect to v ss ........................................................................... -0.3v to (v dd + 0.3v) total power dissipation (1) ............................................................................................................................... 800 mw maximum current out of v ss pin ...................................................................................................................... 95 m a maximum current into v dd pin ......................................................................................................................... 9 5 ma input clamp current, i ik (v i < 0 or v i > v dd ) ??????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????? 20 ma output clamp current, i ok (vo < 0 or vo >v dd ) ??????????????????????????????????????????????????????????????? ???????????????????????????????????????????? 20 ma maximum output current sunk by any i/o pin..................................................................................... ............... 25 ma maximum output current sourced by any i/o pin .................................................................................. ............ 25 ma maximum current sunk by porta.................................................................................................. ................. 90 ma maximum current sourced porta .................................................................................................. ................ 90 ma note 1: power dissipation is calculated as follows: p dis = v dd x {i dd ? ? i oh } + ? {(v dd ? v oh ) x i oh } + ? (v o l x i ol ). ? notice: stresses above those listed under ?absolute maximum ratings? may cause permanent damage to the device. this is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. exposure above maximum rating conditions for extended periods may affect device reliability.
pic12f752/hv752 ds41576b-page 168 preliminary ? 2011 microchip technology inc. figure 20-1: pic12f752 vo ltage-frequency graph, -40c ? t a ? +125c figure 20-2: pic12hv752 vo ltage-frequency graph, -40c ? t a ? +125c 2.0 3.5 2.5 0 3.0 4.0 4.5 5.0 frequency (mhz) v dd (v) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 820 10 5.5 2.0 3.5 2.5 0 3.0 4.0 4.5 5.0 frequency (mhz) v dd (v) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 820 10
? 2011 microchip technology inc. preliminary ds41576b-page 169 pic12f752/hv752 20.1 dc characteristics: pic12f752/hv752-i (industrial) pic12f752/hv752-e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. sym characteristic min typ? max units conditions supply voltage d001 v dd pic12f752 2.0 ? 5.5 v f osc < = 4 mhz d001 pic12hv752 2.0 ? 5.0 (2) v f osc < = 4 mhz d001b v dd pic12f752 2.0 ? 5.5 v f osc < = 8 mhz d001b pic12hv752 2.0 ? 5.0 2) v f osc < = 8 mhz d001c v dd pic12f752 3.0 ? 5.5 v f osc < = 10 mhz d001c pic12hv752 3.0 ? 5.0 2) v f osc < = 10 mhz d001d v dd pic12f752 4.5 ? 5.5 v f osc < = 20 mhz d001d pic12hv752 4.5 ? 5.0 (2) v f osc < = 20 mhz d002* v dr ram data retention voltage (1) 1.5 ? ? v device in sleep mode d003 v por v dd start voltage to ensure internal power-on reset signal ?v ss ?vsee section table 17-1: ?time-out in various situations? for details. d004* s vdd v dd rise rate to ensure internal power-on reset signal 0.05 ? ? v/ms see section table 17-1: ?time-out in various situations? for details. * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered in sleep mode without losing ram data. 2: on the pic12hv752, v dd is regulated by a shunt regulator and is dependent on series resistor (connected between the unregulated supply voltage and the v dd pin) to limit the current to 50 ma. see section 18.0 ?shunt regulator (pic12hv752 only)? for design requirements.
pic12f752/hv752 ds41576b-page 170 preliminary ? 2011 microchip technology inc. 20.2 dc characteristics: pic12f752-i (industrial) pic12f752-e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. device characteristics min typ? max units conditions v dd note d010 supply current (i dd ) (1, 2) ? 8tbd ? a2.0f osc = 31 khz lfintosc mode pic12f752 ? 16 tbd ? a3.0 ?31tbd ? a5.0 d011* ? 140 tbd ? a2.0f osc = 1 mhz hfintosc mode ?215tbd ? a3.0 ?360tbd ? a5.0 d012* ? 185 tbd ? a2.0f osc = 4 mhz ec oscillator mode ?325tbd ? a3.0 ?665tbd ? a5.0 d013* ? 270 tbd ? a2.0f osc = 4 mhz hfintosc mode ?390tbd ? a3.0 ?680tbd ? a5.0 d014 ? 0.395 tbd ma 2.0 f osc = 8 mhz hfintosc mode ? 0.620 tbd ma 3.0 ? 1.2 tbd ma 5.0 d015 ? 2.6 tbd ma 4.5 f osc = 20 mhz ec oscillator mode ? 2.8 tbd ma 5.0 d016 ? 65 ? ? a2.0f osc = 1 mhz ec oscillator mode ?120 ? ? a3.0 ?250 ? ? a5.0 legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the test conditions for all i dd measurements in active operation mode are: clkin = external square wave, from rail-to-rail; all i/o pins tri-stated, pulled to v dd ; mclr = v dd ; wdt disabled. the supply current is mainly a function of the operating voltage and frequency. other factors, such as i/o pin loading and switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the cur- rent consumption.
? 2011 microchip technology inc. preliminary ds41576b-page 171 pic12f752/hv752 20.3 dc characteristics: pic12hv752-i (industrial) pic12hv752-e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. device characteristics min typ? max units conditions v dd note d010 supply current (i dd ) (1, 2) ? 20 tbd ? a2.0f osc = 31 khz lfintosc mode pic12hv752 ? 40 tbd ? a3.0 ?65tbd ? a4.5 d011* ? 215 tbd ? a2.0f osc = 1 mhz hfintosc oscillator mode ? 375 tbd ? a3.0 ? 570 tbd ? a4.5 d012* ? 335 tbd ? a2.0f osc = 4 mhz hfintosc mode ? 535 tbd ? a3.0 ? 795 tbd ? a4.5 d013 ? 0.530 tbd ma 2.0 f osc = 8 mhz hfintosc mode ? 0.830 tbd ma 3.0 ?1.35tbdma 4.5 d014 ? 3.8 tbd ma 4.5 f osc = 20 mhz ec oscillator mode d015 ? 130 ? ? a2.0f osc = 1 mhz ec oscillator mode ? 245 ? ? a3.0 ? 360 ? ? a5.0 d016 ? 250 ? ? a2.0f osc = 4 mhz ec oscillator mode ? 440 ? ? a3.0 ? 660 ? ? a5.0 legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 4.5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the test conditions for all i dd measurements in active operation mode are: clkin = external square wave, from rail-to-rail; all i/o pins tri-stated, pulled to v dd ; mclr = v dd ; wdt disabled. 2: the supply current is mainly a function of the operating voltage and frequency. other factors, such as i/o pin loading and switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the current consumption. 3: for rc oscillator configurations, current through r ext is not included. the current through the resistor can be extended by the formula i r = v dd /2r ext (ma) with r ext in k ??
pic12f752/hv752 ds41576b-page 172 preliminary ? 2011 microchip technology inc. 20.4 dc characteristics: pic12f752 - i (industrial) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. device characteristics min typ? max units conditions v dd note d020 power-down base current (i pd ) (2) ?0.01tbd ? a 2.0 wdt, bor, comparator, v ref and t1osc disabled ?0.3tbd ? a3.0 pic12f752 ? 0.5 tbd ? a5.0 150 tbd na 3.0 - 40c ? t a ? +25c for industrial d021 ? 3.0 tbd ? a 2.0 wdt current (1) ?4.0tbd ? a3.0 ?7.0tbd ? a5.0 d022 ? 5.0 tbd ? a 3.0 bor current (1) ?6.0tbd ? a5.0 d023 ? 362 tbd ? a 2.0 cxsp = 1 , comparator current (1) , single comparator enabled ? 418 tbd ? a3.0 ? 500 tbd ? a5.0 d024 ? 96 tbd ? a 2.0 cxsp = 0 , comparator current (1) , single comparator enabled ?112tbd ? a3.0 ? 132 tbd ? a5.0 d025 ? 0.3 tbd ? a 3.0 a/d current (1) , no conversion in progress ?0.36tbd ? a5.0 d026 ? 0.2 tbd ? a 3.0 dac current (1) ?0.4tbd ? a5.0 d027 ? 59 tbd ? a 3.0 fvr current (1) , fvrbufen = 1 , refout buffer enabled ?98tbd ? a5.0 legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral ? current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in high-impedance state and tied to v dd .
? 2011 microchip technology inc. preliminary ds41576b-page 173 pic12f752/hv752 20.5 dc characteristics: pic12f752 - e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c for extended param no. device characteristics min typ? max units conditions v dd note d020e power-down base current (i pd ) (2) pic12f752 ?0.1tbd ? a 2.0 wdt, bor, comparator, dac and fvr disabled ?0.3tbd ? a3.0 ?0.5tbd ? a5.0 d021e ? 3.0 tbd ? a 2.0 wdt current (1) ?4.0tbd ? a3.0 ?7.0tbd ? a5.0 d022e ? 5.0 tbd ? a 3.0 bor current (1) ?6.0tbd ? a5.0 d023e ? 362 tbd ? a 2.0 cxsp = 1 , comparator current (1) , single comparator enabled ?418tbd ? a3.0 ?500tbd ? a5.0 d024e ? 96 tbd ? a 2.0 cxsp = 0 , comparator current (1) , single comparator enabled ?112tbd ? a3.0 ?132tbd ? a5.0 d025e ? .03 tbd ? a 3.0 a/d current (1) , no conversion in progress ?0.36tbd ? a5.0 d026e ? 0.2 tbd ? a 3.0 dac current (1,3) ?0.4tbd ? a5.0 d027e ? 59 tbd ? a 3.0 fvr current (1) , fvrbufen = 1 , refout buffer enabled ?98tbd ? a5.0 legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral ? current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in high-impedance state and tied to v dd . 3: both or one input reference are in high z-state.
pic12f752/hv752 ds41576b-page 174 preliminary ? 2011 microchip technology inc. 20.6 dc characteristics: pic12hv752 - i (industrial) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. device characteristics min typ? max units conditions v dd note d020 power-down base current (i pd ) (2,3) ?135tbd ? a 2.0 wdt, bor, comparator, dac and fvr disabled ?210tbd ? a3.0 pic12hv752 ? 260 tbd ? a4.5 d021 ? 135 tbd ? a 2.0 wdt current (1) ?210tbd ? a3.0 ?265tbd ? a4.5 d022 ? 215 tbd ? a 3.0 bor current (1) ?265tbd ? a4.5 d023 ? 362 tbd ? a 2.0 cxsp = 1 , comparator current (1) , single comparator enabled ?418tbd ? a3.0 ?450tbd ? a4.5 d024 ? 90 tbd ? a 2.0 cxsp = 0 , comparator current (1) , single comparator enabled ?107tbd ? a3.0 ?127tbd ? a4.5 d025 ? 210 tbd ? a 3.0 a/d current (1) , no conversion in progress ?260tbd ? a4.5 d026 ? 215 tbd ? a 3.0 dac current (1) ?265tbd ? a4.5 d027 ? 485 tbd ? a 3.0 fvr current (1) , fvrbufen = 1 , refout buffer enabled ?615tbd ? a4.5 legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 4.5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral ? current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in high-impedance state and tied to v dd . 3: shunt regulator is always on and always draws operating current.
? 2011 microchip technology inc. preliminary ds41576b-page 175 pic12f752/hv752 20.7 dc characteristics: pic12hv752 -e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c for extended param no. device characteristics min typ? max units conditions v dd note d020e power-down base current (i pd ) (2,3) pic12hv752 ?135tbd ? a 2.0 wdt, bor, comparator, dac and fvr disabled ?210tbd ? a3.0 ?260tbd ? a4.5 d021e ? 135 tbd ? a 2.0 wdt current (1) ?210tbd ? a3.0 ?265tbd ? a4.5 d022e ? 215 tbd ? a 3.0 bor current (1) ?265tbd ? a4.5 d023e ? 185 tbd ? a 2.0 cxsp = 1 , comparator current (1) , single comparator enabled ?265tbd ? a3.0 ?320tbd ? a4.5 d024e ? 90 tbd ? a 2.0 cxsp = 0 , comparator current (1) , single comparator enabled ?107tbd ? a3.0 ?127tbd ? a4.5 d025e ? 210 tbd ? a 3.0 a/d current (1) , no conversion in progress ?260tbd ? a4.5 d026e ? 215 tbd ? a 3.0 dac current (1) ?265tbd ? a4.5 d027e ? 485 tbd ? a 3.0 fvr current (1) , fvrbufen = 1 , refout buffer enabled ?615tbd ? a4.5 legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 4.5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral ? current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in high-impedance state and tied to v dd . 3: shunt regulator is always on and always draws operating current.
pic12f752/hv752 ds41576b-page 176 preliminary ? 2011 microchip technology inc. 20.8 dc characteristics: pic12f752/hv752-i (industrial) pic12f752/hv752-e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. sym characteristic min typ? max units conditions v il input low voltage i/o port: d030 with ttl buffer vss ? 0.8 v 4.5v ? v dd ? 5.5v d030a vss ? 0.15 v dd v2.0v ? v dd ? 4.5v d031 with schmitt trigger buffer vss ? 0.2 v dd v2.0v ? v dd ? 5.5v v ih input high voltage i/o ports: ? d040 with ttl buffer 2.0 ? v dd v4.5v ? v dd ?? 5.5v d040a 0.25 v dd + 0.8 ? v dd v2.0v ? v dd ? 4.5v d041 with schmitt trigger buffer 0.8 v dd ?v dd v2.0v ? v dd ? 5.5v d042 mclr 0.8 v dd ?v dd v i il input leakage current (1,2) d060 i/o ports ? ?? 0.1 ?? 1 ? av ss ?? v pin ?? v dd , pin at high-impedance d061 ra3/mclr (2,3) ? ?? 0.7 ?? 5 ? av ss ?? v pin ?? v dd d063 ? ?? 0.1 ?? 5 ? a ec configuration d070* i pur porta weak pull-up current (4) 50 250 400 ? av dd = 5.0v, v pin = v ss d080 v ol output low voltage i/o ports (excluding ra0, ra2) ? ? ? ? 0.6 0.6 v v i ol = 7.0 ma, v dd = 4.5v, -40c to +125c i ol = 8.5 ma, v dd = 4.5v, -40c to +85c ra0, ra2 ? ? ? ? 0.6 0.6 v v i ol = 14 ma, v dd = 4.5v, -40c to +125c i ol = 17 ma, v dd = 4.5v, -40c to +85c d090 v oh output high voltage i/o ports (1) (excluding ra0, ra2) v dd ? 0.7 v dd ? 0.7 ? ? ? ? v v i oh = -2.5ma, v dd = 4.5v, -40c to +125c i oh = -3.0 ma, v dd = 4.5v, -40c to +85c ra0, ra2 v dd ? 0.7 v dd ? 0.7 ? ? ? ? v v i oh = -5.0 ma, v dd = 4.5v, -40c to +125c i oh = -6.0 ma, v dd = 4.5v, -40c to +85c * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise st ated. these parameters are for design guidance only and are not tested. note 1: negative current is defined as current sourced by the pin. 2: the leakage current on the mclr pin is strongly dependent on the applied volt age level. the specified levels represent normal operating conditions. higher leakage current may be measured at different input voltages. 3: this specification applies to ra3/mclr configured as ra3 with the internal weak pull-up disabled. 4: this specification applies to all weak pull-up pins, including the weak pull-up found on ra3/mclr . when ra3/mclr is configured as mclr reset pin, the weak pull-up is always enabled.
? 2011 microchip technology inc. preliminary ds41576b-page 177 pic12f752/hv752 capacitive loading specs on d101* c io all i/o pins ? ? 50 pf program flash memory d130 e p cell endurance 10k 100k ? e/w -40c ? t a ?? +85c d130a e d cell endurance 1k 10k ? e/w +85c ? t a ?? +125c d131 v pr v dd for read v min ?5.5vv min = minimum operating voltage d132 v pew v dd for bulk erase/write 4.5 ? 5.5 v d132a v pew v dd for row erase/write v min ?5.5v d133 t pew erase/write cycle time ? 2 2.5 ms d134 t retd characteristic retention 40 ? ? year provided no other specifications are violated 20.8 dc characteristics: pic12f752/hv752-i (industrial) pic12f752/hv752-e (extended) (continued) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. sym characteristic min typ? max units conditions * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise st ated. these parameters are for design guidance only and are not tested. note 1: negative current is defined as current sourced by the pin. 2: the leakage current on the mclr pin is strongly dependent on the applied voltage level. the specified levels represent normal operating conditions. higher leakage current may be measured at different input voltages. 3: this specification applies to ra3/mclr configured as ra3 with the internal weak pull-up disabled. 4: this specification applies to all weak pull-up pins, including the weak pull-up found on ra3/mclr . when ra3/mclr is configured as mclr reset pin, the weak pull-up is always enabled.
pic12f752/hv752 ds41576b-page 178 preliminary ? 2011 microchip technology inc. 20.9 thermal considerations standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym characteristic typ units conditions th01 ? ja thermal resistance junction to ambient 84.6* c/w 8-pin pdip package 149.5* c/w 8-pin soic package 60* c/w 8-pin dfn 3x3mm package th02 ? jc thermal resistance junction to case 41.2* c/w 8-pin pdip package 39.9* c/w 8-pin soic package 9* c/w 8-pin dfn 3x3mm package th03 t die die temperature 150* c th04 pd power dissipation ? w pd = p internal + p i / o th05 p internal internal power dissipation ? w p internal = i dd x v dd (note 1) th06 p i / o i/o power dissipation ? w p i / o = ? (i ol * v ol ) + ? (i oh * (v dd - v oh )) th07 p der derated power ? w p der = pd max (t die - t a )/ ? ja (note 2) * these parameters are characterized but not tested. note 1: i dd is current to run the chip alone without driving any load on the output pins. 2: t a = ambient temperature.
? 2011 microchip technology inc. preliminary ds41576b-page 179 pic12f752/hv752 20.10 timing parameter symbology the timing parameter symbols have been created with one of the following formats: figure 20-3: load conditions 1. tpps2pps 2. tpps t f frequency t time lowercase letters (pp) and their meanings: pp cc ccp1 osc osc1 ck clkout rd rd cs cs rw rd or wr di sdi sc sck do sdo ss ss dt data in t0 t0cki io i/o port t1 t1cki mc mclr wr wr uppercase letters and their meanings: s ffall pperiod hhigh rrise i invalid (high-impedance) v valid l low z high-impedance v ss c l legend: c l =50 pf for all pins load condition pin
pic12f752/hv752 ds41576b-page 180 preliminary ? 2011 microchip technology inc. 20.11 ac characteristics: pic12f752/hv752 (industrial, extended) figure 20-4: clock timing table 20-1: clock oscillator timing requirements standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym characteristic min typ? max units conditions os01 f osc external clkin frequency (1) dc ? 20 mhz ec oscillator mode os02 t osc external clkin period (1) 50 ? ? ns ec oscillator mode os03 t cy instruction cycle time (1) 200 t cy dc ns t cy = 4/f osc * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stat ed. these parameters are for des ign guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time base period. all specified values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. exceeding these specified limits may result in an unst able oscillator operation and/or higher than expected current consumption. all devices are tested to operate at ?min? va lues with an external clock applied to clkin pin. when an external clock input is used, the ?max? cycle ti me limit is ?dc? (no clock) for all devices. clkin clkout q4 q1 q2 q3 q4 q1 os02 os03 os04 os04 clkout (clkout mode)
? 2011 microchip technology inc. preliminary ds41576b-page 181 pic12f752/hv752 table 20-2: oscillator parameters standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym characteristic freq. tolerance min typ? max units conditions os06 t warm internal oscillator switch when running (3) ???2t osc slowest clock os07 int osc internal calibrated intosc frequency (2) (4 mhz) ? 1% 3.96 4.0 4.04 mhz v dd = 3.5v, t a = 25c ? 2% 3.92 4.0 4.08 mhz 2.5v ?? v dd ? 5.5v, 0c ? t a ? +85c ? 5% 3.80 4.0 4.2 mhz 2.0v ?? v dd ? 5.5v, -40c ? t a ? +85c (ind.), -40c ? t a ? +125c (ext.) os08 int osc internal calibrated intosc frequency (2) (8 mhz) ? 1% 7.92 8.0 8.08 mhz v dd = 3.5v, t a = 25c ? 2% 7.84 8.0 8.16 mhz 2.5v ?? v dd ? 5.5v, 0c ? t a ? +85c ? 5% 7.60 8.0 8.40 mhz 2.0v ?? v dd ? 5.5v, -40c ? t a ? +85c (ind.), -40c ? t a ? +125c (ext.) os10* t iosc st intosc oscillator wake- up from sleep start-up time ?tbd12tbd ? sv dd = 2.0v, -40c to +85c ? tbd 7 tbd ? sv dd = 3.0v, -40c to +85c ? tbd 6 tbd ? sv dd = 5.0v, -40c to +85c legend: tbd = to be determined * these parameters are char acterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise st ated. these parameters are for design guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time bas e period. all specified values are based on characterization data for that particular oscillator ty pe under standard operating conditions with the device executing code. exceeding these specified limits may result in an unstable oscillator operati on and/or higher than expected current consumption. all devices are tested to operate at ?m in? values with an external clock applied to the clkin pin. when an external clock input is used, the ?max? cycl e time limit is ?dc? (no clock) for all devices. 2: to ensure these oscillator frequency tolerances, v dd and v ss must be capacitively decoupled as close to the device as possible. 0.1 ? f and 0.01 ? f values in parallel are recommended. 3: by design.
pic12f752/hv752 ds41576b-page 182 preliminary ? 2011 microchip technology inc. figure 20-5: clkout and i/o timing f osc clkout i/o pin (input) i/o pin (output) q4 q1 q2 q3 os19 os13 os15 os18, os19 os20 os21 os17 os16 os14 os18 old value new value write fetch read execute cycle table 20-3: clkout and i/o timing parameters standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym characteristic min typ? max units conditions os13 t ck l2 io vclkout ? to port out valid (1) ? ? 20 ns os14 t io v2 ck h port input valid before clkout ? (1) t osc + 200 ns ? ? ns os15 t os h2 io vf osc ? (q1 cycle) to port out valid ? 50 70* ns v dd = 5.0v os16 t os h2 io if osc ? (q2 cycle) to port input invalid (i/o in hold time) 50 ? ? ns v dd = 5.0v os17 t io v2 os h port input valid to f osc ?? (q2 cycle) (i/o in setup time) 20 ? ? ns os18 t io r port output rise time (1) ? ? 15 40 72 32 ns v dd = 2.0v v dd = 5.0v os19 t io f port output fall time (1) ? ? 28 15 55 30 ns v dd = 2.0v v dd = 5.0v os20* t inp int pin input high or low time 25 ? ? ns os21* t rap porta interrupt-on-change new input level time t cy ??ns * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 ? c unless otherwise stated. note 1: includes clkouten = 0 , clkout function enabled.
? 2011 microchip technology inc. preliminary ds41576b-page 183 pic12f752/hv752 figure 20-6: reset, watchdog timer, and power-up timer timing figure 20-7: brown-out rese t timing and characteristics v dd mclr internal por pwrt time-out osc start-up time internal reset (1) watchdog timer 33 32 30 31 34 i/o pins 34 note 1: asserted low. reset (1) v bor v dd (device in brown-out reset) (device not in brown-out reset) 33* 37 * 64 ms delay only if pwrte bit in the configuration word register is programmed to ? 0 ?. reset (due to bor) v bor + v hyst
pic12f752/hv752 ds41576b-page 184 preliminary ? 2011 microchip technology inc. table 20-4: reset, watchdog timer, oscill ator start-up timer, power-up timer and brown-out reset parameters standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym characteristic min typ? max units conditions 30 t mc lmclr pulse width (low) 2 5 ? ? ? ? ? s ? s v dd = 5v, -40c to +85c v dd = 5v, -40c to +125c 31* t wdt watchdog timer time-out period (no prescaler) 10 10 20 20 tbd tbd ms ms v dd = 5v, -40c to +85c v dd = 5v, -40c to +125c 32* t pwrt power-up timer period 40 65 140 ms 33* t ioz i/o high-impedance from mclr low or watchdog timer reset ??2.0 ? s 34 v bor brown-out reset voltage 2.0 2.15 2.3 v (note 4) 35* v hyst brown-out reset hysteresis ? 100 ? mv 36* t bor brown-out reset minimum detection period 100 ? ? ? sv dd ? v bor legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time base period. all specified values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. exceeding these specified limits may result in an unstable oscillator oper- ation and/or higher than expected current consumption. all devices are tested to operate at ?min? values with an external clock applied to the clkin pin. when an external clock input is used, the ?max? cycle time limit is ?dc? (no clock) for all devices. 2: by design. 3: period of the slower clock. 4: to ensure these voltage tolerances, v dd and v ss must be capacitively decoupled as close to the device as possible. 0.1 ? f and 0.01 ? f values in parallel are recommended.
? 2011 microchip technology inc. preliminary ds41576b-page 185 pic12f752/hv752 figure 20-8: timer0 and timer1 external clock timings table 20-5: timer0 and timer1 external clock requirements standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym characteristic min typ? max units conditions 40* t t 0h t0cki high pulse width no prescaler 0.5 t cy + 20 ? ? ns with prescaler 10 ? ? ns 41* t t 0l t0cki low pulse width no prescaler 0.5 t cy + 20 ? ? ns with prescaler 10 ? ? ns 42* t t 0p t0cki period greater of: 20 or t cy + 40 n ? ? ns n = prescale value (2, 4, ..., 256) 45* t t 1h t1cki high time synchronous, no prescaler 0.5 t cy + 20 ? ? ns synchronous, with prescaler 15 ? ? ns asynchronous 30 ? ? ns 46* t t 1l t1cki low time synchronous, no prescaler 0.5 t cy + 20 ? ? ns synchronous, with prescaler 15 ? ? ns asynchronous 30 ? ? ns 47* t t 1p t1cki input period synchronous greater of: 30 or t cy + 40 n ? ? ns n = prescale value (1, 2, 4, 8) asynchronous 60 ? ? ns 49* tckez tmr 1 delay from external clock edge to timer increment 2 t osc ?7 t osc ? timers in sync mode * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stat ed. these parameters are for design guidance only and are not tested. t0cki t1cki 40 41 42 45 46 47 49 tmr0 or tmr1
pic12f752/hv752 ds41576b-page 186 preliminary ? 2011 microchip technology inc. figure 20-9: pic12f752/hv752 capture/compare/pwm timings (ccp) table 20-6: pic12f752/hv752 capture/compare/pwm requirements (ccp) table 20-7: comparator specifications standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym characteristic min typ? max units conditions cc01* tccl ccp1 input low time no prescaler 0.5t cy + 20 ? ? ns with prescaler 20 ? ? ns cc02* tcch ccp1 input high time no prescaler 0.5t cy + 20 ? ? ns with prescaler 20 ? ? ns cc03* tccp ccp1 input period 3t cy + 40 n ? ? ns n = prescale value (1, 4 or 16) * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym characteristics min typ? max units comments cm01 v os input offset voltage (2) ? ? ? 5.0 ? 7.0 ? 10 ? 20 mv mv cxsp = 1 cxsp = 0 cm02 v cm input common mode voltage 0 ? v dd ? 1.5 v cm03* c mrr common mode rejection ratio +55 ? ? db cm04* t rt response time (1) cxsp = 1 ?55 tbd ns cxsp = 0 ?65 tbd ns cm05* t mc 2 co v comparator mode change to output valid ? ? 10 ? s cm06* v hys input hysteresis voltage ? 20 tbd mv legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: response time is measured with one comparator input at (v dd - 1.5)/2 - 100 mv to (v dd - 1.5)/2 + 20 mv. the other input is at (v dd -1.5)/2. 2: input offset voltage is measured with one comparator input at (v dd -1.5v)/2. note: refer to figure 20-3 for load conditions. (capture mode) cc01 cc02 cc03 ccp1
? 2011 microchip technology inc. preliminary ds41576b-page 187 pic12f752/hv752 table 20-8: digital-to-anal og (dac) specifications table 20-9: fixed voltage reference specifications table 20-10: shunt regulator spe cifications (pic12hv752 only) standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym characteristics min typ? max units comments da01* c lsb step size ? v dd /32 ? v da02* c acc absolute accuracy ? ? 1/2 ? lsb da03* c r unit resistor value (r) ? tbd ? ? da04* c st settling time ? 10 ? ? s legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. vr voltage reference specifications standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. symbol characteristics min typ max units comments vr01* v fvr fvr voltage output ? 1.2 ? v vr02* t stable fvr turn on time ? 200 ? ? s * these parameters are characterized but not tested. shunt regulator characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. symbol characteristics min typ max units comments sr01 v shunt shunt voltage 4.75 5 5.4 v sr02 i shunt shunt current 4 ? 50 ma sr03* t settle settling time ? ? 150 ns to 1% of final value sr04 c load load capacitance 0.01 ? 10 ? f bypass capacitor on v dd pin sr05 ? i snt regulator operating current ? 180 ? ? a includes band gap reference current * these parameters are characterized but not tested.
pic12f752/hv752 ds41576b-page 188 preliminary ? 2011 microchip technology inc. table 20-11: pic12f752/hv752 a/d converter (adc) characteristics : standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym characteristic min typ? max units conditions ad01 n r resolution ? ? 10 bits bit ad02 e il integral error ? ? ? 1lsbv ref = 5.12v (5) ad03 e dl differential error ? ? ? 1 lsb no missing codes to 10 bits v ref = 5.12v (5) ad04 e off offset error ? +1.5 +2.0 lsb v ref = 5.12v (5) ad07 e gn gain error ? ? ? 1lsbv ref = 5.12v (5) ad06 ad06a v ref reference voltage (3) 2.2 2.5 ?? v dd v absolute minimum to ensure 1 lsb accuracy ad07 v ain full-scale range v ss ?v ref v ad08 z ain recommended impedance of analog voltage source ?? 10k ? ad09* i ref v ref input current (3) 10 ? 1000 ? aduring v ain acquisition. based on differential of v hold to v ain . ?? 50 ? a during a/d conversion cycle. * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: total absolute error includes integral, differential, offset and gain errors. 2: the a/d conversion result never decreases with an increase in the input voltage and has no missing codes. 3: adc v ref is from external v ref or v dd pin, whichever is selected as reference input. 4: when adc is off, it will not consume any current other than leakage current. the power-down current specification includes any such leakage from the adc module. 5: v ref = 5v for pic12hv752.
? 2011 microchip technology inc. preliminary ds41576b-page 189 pic12f752/hv752 table 20-12: pic12f752/hv752 a/d conversion requirements figure 20-10: pic12f752/hv752 a/d conversion timing (normal mode) standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym characteristic min typ? max units conditions ad130* t ad a/d clock period 1.6 ? 9.0 ? st osc -based, v ref ?? 3.0v 3.0 ? 9.0 ? st osc -based, v ref full range (3) a/d internal rc oscillator period 3.0 6.0 9.0 ? s adcs<2:0> = 11 at v dd = 2.5v 1.6 4.0 6.0 ? sat v dd = 5.0v ad131 t cnv conversion time (not including acquisition time) (1) ?11?t ad set go/done bit to new data in a/d result register ad132* t acq acquisition time 11.5 ? ? s ad133* t amp amplifier settling time ? ? 5 ? s ad134 t go q4 to a/d clock start ? t osc /2 ? ? * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adresh and adresl registers may be read on the following t cy cycle. 2: see section 12.4 ?a/d acquisition requirements? for minimum conditions. 3: full range for pic12hv752 powered by the shunt regulator is the 5v regulated voltage. ad131 ad130 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 987 3210 1 t cy 6 ad134 ( t osc /2) 1 t cy ad132
pic12f752/hv752 ds41576b-page 190 preliminary ? 2011 microchip technology inc. figure 20-11: pic12f752/hv752 a/d co nversion timing (sleep mode) ad132 ad131 ad130 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 9 7 3210 ad134 6 8 1 t cy ( t osc /2 + t cy ) 1 t cy
? 2011 microchip technology inc. preliminary ds41576b-page 191 pic12f752/hv752 21.0 dc and ac characteristics graphs and charts graphs and charts are not available at this time.
pic12f752/hv752 ds41576b-page 192 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 193 pic12f752/hv752 22.0 packaging information 22.1 package marking information * standard pic device marking consists of microchip part nu mber, year code, week code, and traceability code. for pic device marking beyond this, certain price adders apply. pl ease check with your microchip sales office. for qtp devices, any special marking adder s are included in qtp price. legend: xx...x customer-specific information y year code (last digit of calendar year) yy year code (last 2 digits of calendar year) ww week code (week of january 1 is week ?01?) nnn alphanumeric traceability code pb-free jedec designator for matte tin (sn) * this package is pb-free. the pb-free jedec designator ( ) can be found on the outer packaging for this package. note : in the event the full microchip part number cannot be marked on one line, it will be carried over to the next line, thus limiti ng the number of available characters for customer-specific information. 3 e 3 e 8-lead pdip (300 mil) example xxxxxxxx xxxxxnnn yyww 1109 12f752 8-lead soic (3.90 mm) example nnn n 121 e/p 121 3 e
pic12f752/hv752 ds41576b-page 194 preliminary ? 2011 microchip technology inc. 22.2 package marking information * standard pic device marking consists of microchip part num ber, year code, week code, and traceability code. for pic device marking beyond this, certain price adders apply. pleas e check with your microchip sales office. for qtp devices, any special marking adde rs are included in qtp price. legend: xx...x customer-specific information y year code (last digit of calendar year) yy year code (last 2 digits of calendar year) ww week code (week of january 1 is week ?01?) nnn alphanumeric traceability code pb-free jedec designator for matte tin (sn) * this package is pb-free. the pb-f ree jedec designator ( ) can be found on the outer packaging for this package. note : in the event the full microchip part number cannot be marked on one line, it will be carried over to the next line, thus limiti ng the number of available characters for customer-specific information. 3 e 3 e 8-lead dfn (3x3x0.9 mm) example xxxx nnn yyww pin 1 pin 1 11 11 1: x n p in pt ne pic12f752-e/mf mfu0 pic12f752-i/mf mfv0 pic12hv752-e/mf mfw0 pic12hv752-i/mf mfx0
? 2011 microchip technology inc. preliminary ds41576b-page 195 pic12f752/hv752 22.3 package details the following sections give the technical details of the packages. n e1 note 1 d 12 3 a a1 a2 l b1 b e e eb c
pic12f752/hv752 ds41576b-page 196 preliminary ? 2011 microchip technology inc. note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
? 2011 microchip technology inc. preliminary ds41576b-page 197 pic12f752/hv752 note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
pic12f752/hv752 ds41576b-page 198 preliminary ? 2011 microchip technology inc. note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
? 2011 microchip technology inc. preliminary ds41576b-page 199 pic12f752/hv752
pic12f752/hv752 ds41576b-page 200 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 201 pic12f752/hv752 appendix a: data sheet revision history revision a original release (4/2011). revision b redefined operation of the cog module; added slew rate control to the cog module; added zero latency filter to the comparator; updated electrical specifica- tions. appendix b: migrating from pic12hv615 this compares the features of the pic12hv615 to the pic12hv752 family of devices. b.1 pic12hv615 to pic12hv752 table b-1: feature comparison feature pic12hv615 pic12hv752 max operating speed 20 mhz 20 mhz max program memory (words) 1024 1024 flash self read/ self write no yes sram (bytes) 64 64 oscillator modes 8 2 intosc frequencies 4/8 mhz 1/4/8 mhz and 31 khz brown-out reset (bor) y y internal pull-ups gp0/1/2/3/4/5 ra0/1/2/3/4/5 interrupt-on-change gp0/1/2/3/4/5 ra0/1/2/3/4/5 analog-to-digital converter (adc) channels 44 a/d resolution 10-bit 10-bit timers (8/16-bit) 2/1 3/1 comparator 1 2 high speed eccp/ccp 1/0 0/1 complementary output generator (cog) no yes digital-to-analog converter (dac) 5-bit dual range no yes fixed voltage reference (fvr) no yes internal shunt regulator yes yes note: this device has been designed to perform to the parameters of its data sheet. it has been tested to an electrical specification designed to determine its conformance with these parameters. due to process differences in the manufacture of this device, this device may have different performance characteristics than its earlier version. these differences may cause this device to perform differently in your application than the earlier version of this device.
pic12f752/hv752 ds41576b-page 202 preliminary ? 2011 microchip technology inc. notes:
? 2011 microchip technology inc. preliminary ds41576b-page 203 pic12f752/hv752 index a a/d specifications.................................................... 188, 189 absolute maximum ratings .............................................. 167 ac characteristics industrial and extended ............................................ 180 load conditions ........................................................ 179 adc .................................................................................. 101 acquisition requirements ......................................... 109 associated registers.................................................. 111 block diagram........................................................... 101 calculating acquisition time..................................... 109 channel selection..................................................... 102 configuration............................................................. 102 configuring interrupt ................................................. 105 conversion clock...................................................... 102 conversion procedure .............................................. 105 internal sampling switch (r ss ) impedance.............. 109 interrupts................................................................... 103 operation .................................................................. 104 operation during sleep ............................................ 104 port configuration ..................................................... 102 reference voltage (v ref )......................................... 102 result formatting...................................................... 104 source impedance.................................................... 109 special event trigger................................................ 104 starting an a/d conversion ...................................... 104 adcon0 register............................................................. 106 adcon1 register............................................................. 107 adresh register (adfm = 0) ......................................... 108 adresh register (adfm = 1) ......................................... 108 adresl register (adfm = 0).......................................... 108 adresl register (adfm = 1).......................................... 108 alternate pin function......................................................... 46 analog-to-digital converter. see adc ansela register ............................................................... 50 apfcon register............................................................... 46 assembler mpasm assembler................................................... 164 b block diagrams (ccp) capture mode operation ................................. 77 adc .......................................................................... 101 adc transfer function ............................................. 110 analog input model ........................................... 110, 126 ccp pwm................................................................... 81 clock source............................................................... 39 compare ..................................................................... 79 digital-to-analog converter (dac)............................ 115 generic i/o port .......................................................... 45 hltmr1...................................................................... 73 in-circuit serial programming connections.............. 160 interrupt logic ........................................................... 153 mclr circuit............................................................. 145 on-chip reset circuit ............................................... 143 pic12f752/hv752........................................................ 9 timer1....................................................... 59, 64, 65, 66 timer2......................................................................... 71 tmr0/wdt prescaler................................................. 55 voltage reference .................................................... 113 voltage reference output buffer example............... 117 watchdog timer........................................................ 156 brown-out reset (bor).................................................... 146 associated registers................................................ 146 specifications ........................................................... 184 timing and characteristics ....................................... 183 c c compilers mplab c18 .............................................................. 164 calibration bits.................................................................. 143 capture module. see capture/compare/pwm (ccp) capture/compare/pwm ..................................................... 77 capture/compare/pwm (ccp) .......................................... 77 associated registers w/ capture ............................... 78 associated registers w/ compare ............................. 80 capture mode ............................................................. 77 ccp1 pin configuration ............................................. 77 compare mode ........................................................... 79 ccp1 pin configuration ..................................... 79 software interrupt mode ............................... 77, 79 special event trigger ......................................... 79 timer1 mode resource ................................ 77, 79 prescaler .................................................................... 77 pwm mode duty cycle .......................................................... 82 pwm operation .......................................................... 81 pwm overview ........................................................... 81 pwm period ............................................................... 82 pwm setup ................................................................ 82 specifications ........................................................... 186 ccp. see capture/compare/pwm ccp1con (ccp1) register............................................... 83 clock sources external modes ec ...................................................................... 40 internal modes............................................................ 40 cmout register .............................................................. 128 cmxcon0 register .......................................................... 127 cmxcon1 register .......................................................... 128 code examples a/d conversion ........................................................ 105 assigning prescaler to timer0.................................... 56 assigning prescaler to wdt....................................... 56 changing between capture prescalers ..................... 77 indirect addressing ..................................................... 26 initializing porta ...................................................... 45 saving status and w registers in ram ................... 155 writing to flash program memory.............................. 36 code protection ................................................................ 159 cogxasd register ............................................................ 97 cogxblk register............................................................. 98 cogxcon0 register ......................................................... 95 cogxcon1 register ......................................................... 96 cogxdb register .............................................................. 98 cogxph register .............................................................. 98 comparator....................................................................... 121 associated registers................................................ 129 operation.................................................................. 121 comparator module .......................................................... 121 cx output state versus input conditions................. 123 comparators c2out as t1 gate..................................................... 61 specifications ........................................................... 186 compare module. see capture/compare/pwm (ccp) config1 register ........................................................... 142
pic12f752/hv752 ds41576b-page 204 preliminary ? 2011 microchip technology inc. configuration bits.............................................................. 141 cpu features ................................................................... 141 customer change notification service ............................. 207 customer notification service........................................... 207 customer support ............................................................. 207 d daccon0 (digital-to-analog converter control 0) register..................................................................... 118 daccon1 (digital-to-analog converter control 1) register..................................................................... 118 data memory....................................................................... 11 dc characteristics extended and industrial ............................................ 176 industrial and extended ............................................ 169 development support ....................................................... 163 device overview ................................................................... 9 digital-to-analog (dac) specifications............................................................ 187 digital-to-analog converter (dac).................................... 115 associated registers ................................................ 119 effects of a reset...................................................... 117 e electrical specifications .................................................... 167 errata .................................................................................... 7 f firmware instructions........................................................ 131 fixed voltage reference (fvr) associated registers ................................................ 114 specifications............................................................ 187 flash program memory associated registers .................................................. 37 configuration word w/ flash program memory .......... 37 flash program memory self read/self write control......... 29 fvrcon (fixed voltage reference control) register ..... 114 g general purpose register file............................................ 12 h hardware limit timer (hlt)................................................ 73 high temperature operation ............................................ 190 hlt associated registers.................................................... 76 hlt1con0 (hlt1 control 0) register ............................... 75 hlt1con1 (hlt1 control 1) register ............................... 76 i id locations ...................................................................... 159 in-circuit serial programming (icsp) ............................... 160 indirect addressing, indf and fsr registers ..................... 26 instruction format ............................................................. 131 instruction set ................................................................... 131 addlw ..................................................................... 133 addwf ..................................................................... 133 andlw ..................................................................... 133 andwf ..................................................................... 133 movf........................................................................ 136 bcf ........................................................................... 133 bsf ........................................................................... 133 btfsc ...................................................................... 133 btfss ...................................................................... 134 call ......................................................................... 134 clrf......................................................................... 134 clrw ....................................................................... 134 clrwdt .................................................................. 134 comf ....................................................................... 134 decf ........................................................................ 134 decfsz ................................................................... 135 goto ....................................................................... 135 incf ......................................................................... 135 incfsz..................................................................... 135 iorlw ...................................................................... 135 iorwf...................................................................... 135 movlw .................................................................... 136 movwf .................................................................... 136 nop .......................................................................... 136 retfie ..................................................................... 137 retlw ..................................................................... 137 return................................................................... 137 rlf ........................................................................... 138 rrf .......................................................................... 138 sleep ...................................................................... 138 sublw ..................................................................... 138 subwf..................................................................... 139 swapf ..................................................................... 139 xorlw .................................................................... 139 xorwf .................................................................... 139 summary table ........................................................ 132 intcon register................................................................ 20 internal oscillator block intosc specifications ........................................... 181, 182 internal sampling switch (r ss ) impedance...................... 109 internet address ............................................................... 207 interrupts........................................................................... 152 adc .......................................................................... 105 associated registers ................................................ 154 context saving ......................................................... 155 interrupt-on-change ................................................... 49 porta interrupt-on-change .................................... 153 ra2/int .................................................................... 152 timer0 ...................................................................... 153 tmr1 .......................................................................... 63 intosc specifications ............................................. 181, 182 iocaf register .................................................................. 52 iocan register .................................................................. 52 iocap register .................................................................. 52 l lata register .................................................................... 48 load conditions................................................................ 179 m mclr ................................................................................ 145 internal...................................................................... 145 memory organization ................................................... 11, 85 data ............................................................................ 11 program ...................................................................... 11 microchip internet web site.............................................. 207 migrating from other pic devices..................................... 201 mplab asm30 assembler, linker, librarian ................... 164 mplab integrated development environment software.. 163 mplab pm3 device programmer .................................... 166 mplab real ice in-circuit emulator system ................ 165 mplink object linker/mplib object librarian ................ 164
? 2011 microchip technology inc. preliminary ds41576b-page 205 pic12f752/hv752 o opcode field descriptions ............................................. 131 operation during code protect........................................... 34 operation during write protect ........................................... 34 operational amplifier (opa) module ac specifications...................................................... 187 option register................................................................ 19 option_reg register ...................................................... 57 oscillator associated registers........................................ 43, 69, 99 configuration word ..................................................... 43 oscillator module .......................................................... 29, 39 oscillator parameters ....................................................... 181 oscillator specifications.................................................... 180 oscillator start-up timer (ost) specifications............................................................ 184 osctune register ............................................................ 43 p packaging ......................................................................... 193 marking ............................................................. 193, 194 pdip details.............................................................. 194 pcl and pclath ............................................................... 26 stack ........................................................................... 26 pcon register ........................................................... 25, 147 pie1 register...................................................................... 21 pie2 register...................................................................... 22 pinout descriptions pic12f752/hv752...................................................... 10 pir1 register...................................................................... 23 pir2 register...................................................................... 24 pmadrh and pmadrl registers ..................................... 29 pmcon1 and pmcon2 registers ..................................... 29 pmcon1 register .............................................................. 31 pmdath register .............................................................. 30 pmdatl register ............................................................... 30 pmdrh register ................................................................ 30 porta additional pin functions ............................................. 49 ansel register.................................................. 49 interrupt-on-change ........................................... 49 slew rate control ............................................... 49 weak pull-ups .................................................... 49 associated registers .................................................. 53 ra2 ............................................................................. 53 ra3 ............................................................................. 53 ra4 ............................................................................. 53 specifications............................................................ 182 porta register ................................................................. 48 power-down mode (sleep) ............................................... 158 power-on reset (por) ..................................................... 144 power-up timer (pwrt) .................................................. 145 specifications............................................................ 184 precision internal oscillator parameters........................... 182 prescaler shared wdt/timer0 ................................................... 56 switching prescaler assignment................................. 56 program memory ................................................................ 11 map and stack ............................................................ 11 programming, device instructions .................................... 131 protection against spurious write ...................................... 34 pwm (ccp module) pwm steering............................................................. 83 pwm steering ..................................................................... 83 r reader response............................................................. 208 reading the flash program memory.................................. 32 read-modify-write operations ......................................... 131 registers adcon0 (adc control 0) ........................................ 106 adcon1 (adc control 1) ........................................ 107 adresh (adc result high) with adfm = 0) .......... 108 adresh (adc result high) with adfm = 1) .......... 108 adresl (adc result low) with adfm = 0)............ 108 adresl (adc result low) with adfm = 1)............ 108 ansela (porta analog select) .............................. 50 apfcon (alternate pin function control) ................. 46 ccp1con (ccp1 control) ........................................ 83 cmout (comparator output) .................................. 128 cmxcon0 (cx control) ............................................ 127 cmxcon1 (cx control 1)......................................... 128 cogxasd (cog auto-shutdown control) ................ 97 cogxblk (cog blanking deadband counter) ......... 98 cogxcon0 (cog control 0) .................................... 95 cogxcon1 (cog control 1) .................................... 96 cogxdb (cog deadband counter).......................... 98 cogxph (cog blanking phase counter) ................. 98 configuration word 1................................................ 142 daccon0 ................................................................ 118 daccon1 ................................................................ 118 data memory map ...................................................... 13 fvrcon .................................................................. 114 hlt1con0................................................................. 75 hlt1con1................................................................. 76 intcon (interrupt control) ........................................ 20 iocaf (interrupt-on-change flag)............................. 52 iocan (interrupt-on-change negative edge)............ 52 iocap (interrupt-on-change positive edge).............. 52 lata (data latch porta) ........................................ 48 option_reg (option)..................................... 19, 57 osctune (oscillator tuning).................................... 43 pcon (power control) ....................................... 25, 147 pie1 (peripheral interrupt enable 1) .......................... 21 pie2 (peripheral interrupt enable 2) .......................... 22 pir1 (peripheral interrupt register 1) ........................ 23 pir2 (peripheral interrupt register 2) ........................ 24 pmcon1 (program memory control 1) ..................... 31 pmdath (program memory data)............................. 30 pmdatl (program memory data) ............................. 30 pmdrh (program memory address) ......................... 30 porta ....................................................................... 48 reset values ............................................................ 149 reset values (special registers)............................... 151 special function registers......................................... 12 status ..................................................................... 18 t1con (timer1 control) ............................................ 67 t1gcon (timer1 gate control)................................. 68 t2con ....................................................................... 72 trisa (tri-state porta) .......................................... 48 wpua (weak pull-up porta)................................... 50 reset ................................................................................ 143 revision history................................................................ 201 s shunt regulator................................................................ 161 sleep power-down mode ................................................... 158 wake-up ................................................................... 158 wake-up using interrupts ......................................... 158
pic12f752/hv752 ds41576b-page 206 preliminary ? 2011 microchip technology inc. slew rate control ............................................................... 49 software simulator (mplab sim)..................................... 165 special event trigger........................................................ 104 special function registers ................................................. 12 status register................................................................ 18 t t1con register.................................................................. 67 t1gcon register............................................................... 68 t2con register.................................................................. 72 thermal considerations .................................................... 178 time-out sequence........................................................... 147 timer0 ................................................................................. 55 associated registers .................................................. 57 external clock............................................................. 56 interrupt....................................................................... 57 operation .............................................................. 55, 60 specifications............................................................ 185 t0cki .......................................................................... 56 timer1 associated registers.................................................... 69 asynchronous counter mode ..................................... 61 reading and writing ........................................... 61 interrupt....................................................................... 63 modes of operation .................................................... 60 operation during sleep .............................................. 63 prescaler..................................................................... 61 specifications............................................................ 185 timer1 gate selecting source................................................. 61 tmr1h register ......................................................... 59 tmr1l register.......................................................... 59 timer2 associated registers.............................................. 72, 76 timers hlt hlt1con0 ......................................................... 75 hlt1con1 ......................................................... 76 timer1 t1con................................................................ 67 t1gcon ............................................................. 68 timer2 t2con................................................................ 72 timing diagrams a/d conversion ......................................................... 189 a/d conversion (sleep mode) .................................. 190 brown-out reset (bor) ............................................ 183 brown-out reset situations ...................................... 146 capture/compare/pwm (ccp)................................. 186 clkout and i/o....................................................... 182 clock timing ............................................................. 180 comparator output ................................................... 121 int pin interrupt........................................................ 154 time-out sequence case 1............................................................... 147 case 2............................................................... 147 case 3............................................................... 148 timer0 and timer1 external clock ........................... 185 timer1 incrementing edge.......................................... 63 wake-up from interrupt ............................................. 159 timing parameter symbology........................................... 179 trisa register ................................................................... 48 v v ref . s ee adc reference voltage w wake-up using interrupts ................................................. 158 watchdog timer (wdt).................................................... 155 associated registers ................................................. 157 configuration word w/ watchdog timer................... 157 specifications ........................................................... 184 wpua register................................................................... 50 writing the flash program memory .................................... 34 www address ................................................................. 207 www, on-line support ......... .............................................. 7
? 2011 microchip technology inc. ds41576b-page 207 pic12f752/hv752 the microchip web site microchip provides online support via our www site at www.microchip.com . this web site is used as a means to make files and information easily available to customers. accessible by using your favorite internet browser, the web site contains the following information: ? product support ? data sheets and errata, application notes and sample programs, design resources, user?s guides and hardware support documents, latest software releases and archived software ? general technical support ? frequently asked questions (faq), technical support requests, online discussion groups, microchip consultant program member listing ? business of microchip ? product selector and ordering guides, latest microchip press releases, listing of seminars and events, listings of microchip sales offices, distributors and factory representatives customer change notification service microchip?s customer notification service helps keep customers current on microchip products. subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. to register, access the microchip web site at www.microchip.com . under ?support?, click on ?customer change notification? and follow the registration instructions. customer support users of microchip products can receive assistance through several channels: ? distributor or representative ? local sales office ? field application engineer (fae) ? technical support ? development systems information line customers should contact their distributor, representative or field application engineer (fae) for support. local sales offices are also available to help customers. a listing of sales offices and locations is included in the back of this document. technical support is available through the web site at: http://microchip.com/support
pic12f752/hv752 ds41576b-page 208 preliminary ? 2011 microchip technology inc. reader response it is our intention to provide you with the best documentation possible to ensure successful use of your microchip product. if you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation can better serve you, please fax your comments to the technical publications manager at (480) 792-4150. please list the following information, and use this outline to provide us with your comments about this document. to: technical publications manager re: reader response total pages sent ________ from: name company address city / state / zip / country telephone: (_______) _________ - _________ application (optional): would you like a reply? y n device: literature number: questions: fax: (______) _________ - _________ ds41576b pic12f752/hv752 1. what are the best features of this document? 2. how does this document meet your hardware and software development needs? 3. do you find the organization of this document easy to follow? if not, why? 4. what additions to the document do you think would enhance the structure and subject? 5. what deletions from the document could be made without affecting the overall usefulness? 6. is there any incorrect or misleading information (what and where)? 7. how would you improve this document?
? 2011 microchip technology inc. preliminary ds41576b-page 209 pic12f752/hv752 product identification system to order or obtain information, e. g., on pricing or delivery, refer to the factory or the listed sales office . part no. x /xx xxx pattern package temperature range device device: pic12f752 pic12hv752 tape and reel option: blank = standard packaging (tube or tray) t = tape and reel (1) temperature range: i= -40 ? c to +85 ? c (industrial) e= -40 ? c to +125 ? c (extended) package: p = plastic dip (pdip) sn = 8-lead small outline (150 mil) (soic) mf = 8-lead plastic dual flat, no lead (3x3) (dfn) pattern: qtp, sqtp, code or special requirements (blank otherwise) examples: a) pic12f752t - i/mf 301 tape and reel, industrial temperature, dfn 3x3 package, qtp pattern #301 b) pic12f752 - e/p extended temperature pdip package c) pic12f752 - e/sn extended temperature, soic package d) pic12hv752 - e/mf extended temperature, dfn 3x3 package note 1: tape and reel identifier only appears in the catalog part number description. this identifier is used for ordering purposes and is not printed on the device package. check with your microchip sales office for package availability with the tape and reel option. note 1: t = in tape and reel for soic and dfn packages only. [x] (1) tape and reel option -
ds41576b-page 210 preliminary ? 2011 microchip technology inc. americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: http://www.microchip.com/ support web address: www.microchip.com atlanta duluth, ga tel: 678-957-9614 fax: 678-957-1455 boston westborough, ma tel: 774-760-0087 fax: 774-760-0088 chicago itasca, il tel: 630-285-0071 fax: 630-285-0075 cleveland independence, oh tel: 216-447-0464 fax: 216-447-0643 dallas addison, tx tel: 972-818-7423 fax: 972-818-2924 detroit farmington hills, mi tel: 248-538-2250 fax: 248-538-2260 indianapolis noblesville, in tel: 317-773-8323 fax: 317-773-5453 los angeles mission viejo, ca tel: 949-462-9523 fax: 949-462-9608 santa clara santa clara, ca tel: 408-961-6444 fax: 408-961-6445 toronto mississauga, ontario, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific asia pacific office suites 3707-14, 37th floor tower 6, the gateway harbour city, kowloon hong kong tel: 852-2401-1200 fax: 852-2401-3431 australia - sydney tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing tel: 86-10-8569-7000 fax: 86-10-8528-2104 china - chengdu tel: 86-28-8665-5511 fax: 86-28-8665-7889 china - chongqing tel: 86-23-8980-9588 fax: 86-23-8980-9500 china - hangzhou tel: 86-571-2819-3187 fax: 86-571-2819-3189 china - hong kong sar tel: 852-2401-1200 fax: 852-2401-3431 china - nanjing tel: 86-25-8473-2460 fax: 86-25-8473-2470 china - qingdao tel: 86-532-8502-7355 fax: 86-532-8502-7205 china - shanghai tel: 86-21-5407-5533 fax: 86-21-5407-5066 china - shenyang tel: 86-24-2334-2829 fax: 86-24-2334-2393 china - shenzhen tel: 86-755-8203-2660 fax: 86-755-8203-1760 china - wuhan tel: 86-27-5980-5300 fax: 86-27-5980-5118 china - xian tel: 86-29-8833-7252 fax: 86-29-8833-7256 china - xiamen tel: 86-592-2388138 fax: 86-592-2388130 china - zhuhai tel: 86-756-3210040 fax: 86-756-3210049 asia/pacific india - bangalore tel: 91-80-3090-4444 fax: 91-80-3090-4123 india - new delhi tel: 91-11-4160-8631 fax: 91-11-4160-8632 india - pune tel: 91-20-2566-1512 fax: 91-20-2566-1513 japan - yokohama tel: 81-45-471- 6166 fax: 81-45-471-6122 korea - daegu tel: 82-53-744-4301 fax: 82-53-744-4302 korea - seoul tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 malaysia - kuala lumpur tel: 60-3-6201-9857 fax: 60-3-6201-9859 malaysia - penang tel: 60-4-227-8870 fax: 60-4-227-4068 philippines - manila tel: 63-2-634-9065 fax: 63-2-634-9069 singapore tel: 65-6334-8870 fax: 65-6334-8850 taiwan - hsin chu tel: 886-3-5778-366 fax: 886-3-5770-955 taiwan - kaohsiung tel: 886-7-536-4818 fax: 886-7-330-9305 taiwan - taipei tel: 886-2-2500-6610 fax: 886-2-2508-0102 thailand - bangkok tel: 66-2-694-1351 fax: 66-2-694-1350 europe austria - wels tel: 43-7242-2244-39 fax: 43-7242-2244-393 denmark - copenhagen tel: 45-4450-2828 fax: 45-4485-2829 france - paris tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany - munich tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy - milan tel: 39-0331-742611 fax: 39-0331-466781 netherlands - drunen tel: 31-416-690399 fax: 31-416-690340 spain - madrid tel: 34-91-708-08-90 fax: 34-91-708-08-91 uk - wokingham tel: 44-118-921-5869 fax: 44-118-921-5820 worldwide sales and service 08/02/11


▲Up To Search▲   

 
Price & Availability of PIC12F752-I-SN

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X